お客さん左右対応
This commit is contained in:
parent
9787bbf35f
commit
ec555f0cc2
|
|
@ -59,6 +59,7 @@ public class CustomerController : MonoBehaviour
|
||||||
private static readonly float leftEndPosision = -10f;
|
private static readonly float leftEndPosision = -10f;
|
||||||
// 停止時間
|
// 停止時間
|
||||||
// 左右どちらから出るか
|
// 左右どちらから出るか
|
||||||
|
private float walkSideDirection;
|
||||||
private Subject<Unit> orderSubject = new Subject<Unit>();
|
private Subject<Unit> orderSubject = new Subject<Unit>();
|
||||||
public IObservable<Unit> OrderObservable => orderSubject;
|
public IObservable<Unit> OrderObservable => orderSubject;
|
||||||
|
|
||||||
|
|
@ -80,8 +81,13 @@ public class CustomerController : MonoBehaviour
|
||||||
|
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
|
walkSideDirection = Mathf.Sign(Random.value - .5f);
|
||||||
|
if (walkSideDirection < 0)
|
||||||
|
{
|
||||||
|
transform.localRotation = Quaternion.Euler(Vector3.up * 180);
|
||||||
|
}
|
||||||
beginPos = Vector3.zero;
|
beginPos = Vector3.zero;
|
||||||
beginPos.x = leftEndPosision;
|
beginPos.x = leftEndPosision * walkSideDirection;
|
||||||
beginPos.y = Random.Range(walkSideMidPos, walkSideBottomPos);
|
beginPos.y = Random.Range(walkSideMidPos, walkSideBottomPos);
|
||||||
beginPos.z = beginPos.y + Mathf.Abs(walkSideBottomPos);
|
beginPos.z = beginPos.y + Mathf.Abs(walkSideBottomPos);
|
||||||
transform.localPosition = beginPos;
|
transform.localPosition = beginPos;
|
||||||
|
|
@ -104,7 +110,7 @@ public class CustomerController : MonoBehaviour
|
||||||
animator.SetTrigger(WalkFront);
|
animator.SetTrigger(WalkFront);
|
||||||
break;
|
break;
|
||||||
case CustomerMovingType.WalkSide:
|
case CustomerMovingType.WalkSide:
|
||||||
SetWayPoint(new Vector3(-leftEndPosision, wayPoint.y));
|
SetWayPoint(new Vector3(-leftEndPosision * walkSideDirection, wayPoint.y));
|
||||||
speed = walkSideSpeed;
|
speed = walkSideSpeed;
|
||||||
animator.SetTrigger(WalkSide);
|
animator.SetTrigger(WalkSide);
|
||||||
break;
|
break;
|
||||||
|
|
@ -133,7 +139,7 @@ public class CustomerController : MonoBehaviour
|
||||||
animator.SetTrigger(WalkFrontEat);
|
animator.SetTrigger(WalkFrontEat);
|
||||||
break;
|
break;
|
||||||
case CustomerMovingType.WalkSideEat:
|
case CustomerMovingType.WalkSideEat:
|
||||||
SetWayPoint(new Vector3(-leftEndPosision, wayPoint.y));
|
SetWayPoint(new Vector3(-leftEndPosision * walkSideDirection, wayPoint.y));
|
||||||
speed = walkSideSpeed;
|
speed = walkSideSpeed;
|
||||||
animator.SetTrigger(WalkSideEat);
|
animator.SetTrigger(WalkSideEat);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue