お客さん左右対応
This commit is contained in:
parent
9787bbf35f
commit
ec555f0cc2
|
|
@ -59,6 +59,7 @@ public class CustomerController : MonoBehaviour
|
|||
private static readonly float leftEndPosision = -10f;
|
||||
// 停止時間
|
||||
// 左右どちらから出るか
|
||||
private float walkSideDirection;
|
||||
private Subject<Unit> orderSubject = new Subject<Unit>();
|
||||
public IObservable<Unit> 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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue