Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (state == UnitychanState.IDLE)
        {
            return;
        }

        var distance = GetDistance();

        if (state == UnitychanState.WALK && distance < 7.5f)
        {
            provider.StartRun();
            state = UnitychanState.RUN;
        }

        if (GameManager.gameMode == GameMode.ESCAPE)
        {
            var isLeftAtPlayerPos = (playerTrans.position.x + 1) < transform.position.x ? true : false;

            if (!isLeftAtPlayerPos)
            {
                return;
            }

            StopMove();
            provider.PlayEscapedAnimation();
            isCry = true;
        }
        //Debug.Log("Distance:"+GetDistance());
    }
Esempio n. 2
0
 public void StartMove()
 {
     if (state != UnitychanState.IDLE)
     {
         return;
     }
     maxDistance = GetDistance();
     state       = UnitychanState.WALK;
     StartCoroutine(FootStep(GetDistance()));
 }
Esempio n. 3
0
 public void StopMove()
 {
     state = UnitychanState.IDLE;
 }
Esempio n. 4
0
 // Use this for initialization
 void Awake()
 {
     provider = GetComponent <UnitychanProvider>();
     state    = UnitychanState.IDLE;
 }