diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs index 9262cf11..24ddf91c 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs @@ -59,6 +59,7 @@ public class CustomerController : MonoBehaviour private static readonly float leftEndPosision = -10f; // 停止時間 // 左右どちらから出るか + private float walkSideDirection; private Subject orderSubject = new Subject(); public IObservable OrderObservable => orderSubject; @@ -80,8 +81,13 @@ public class CustomerController : MonoBehaviour public void Setup() { + walkSideDirection = Mathf.Sign(Random.value - .5f); + if (walkSideDirection < 0) + { + transform.localRotation = Quaternion.Euler(Vector3.up * 180); + } beginPos = Vector3.zero; - beginPos.x = leftEndPosision; + beginPos.x = leftEndPosision * walkSideDirection; beginPos.y = Random.Range(walkSideMidPos, walkSideBottomPos); beginPos.z = beginPos.y + Mathf.Abs(walkSideBottomPos); transform.localPosition = beginPos; @@ -104,7 +110,7 @@ public class CustomerController : MonoBehaviour animator.SetTrigger(WalkFront); break; case CustomerMovingType.WalkSide: - SetWayPoint(new Vector3(-leftEndPosision, wayPoint.y)); + SetWayPoint(new Vector3(-leftEndPosision * walkSideDirection, wayPoint.y)); speed = walkSideSpeed; animator.SetTrigger(WalkSide); break; @@ -133,7 +139,7 @@ public class CustomerController : MonoBehaviour animator.SetTrigger(WalkFrontEat); break; case CustomerMovingType.WalkSideEat: - SetWayPoint(new Vector3(-leftEndPosision, wayPoint.y)); + SetWayPoint(new Vector3(-leftEndPosision * walkSideDirection, wayPoint.y)); speed = walkSideSpeed; animator.SetTrigger(WalkSideEat); break;