From ec555f0cc22be7e2c36eb099710bf331f55f230f Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 31 Aug 2021 11:53:16 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=8A=E5=AE=A2=E3=81=95=E3=82=93=E5=B7=A6?= =?UTF-8?q?=E5=8F=B3=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Scripts/CustomerController.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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;