Exemplo n.º 1
0
    void DoMove()
    {
        Vector3 _dirVec = _goalPos - transform.position;
        Vector3 _disVec = (Vector2)_goalPos - (Vector2)transform.position;

        if (_disVec.sqrMagnitude < 0.1f)
        {
            _prefabs.PlayAnimation(0);
            _playerState = PlayerState.idle;
            return;
        }
        Vector3 _dirMVec = _dirVec.normalized;

        transform.position += (_dirMVec * _charMS * Time.deltaTime);


        if (_dirMVec.x > 0)
        {
            _prefabs.transform.localScale = new Vector3(-1, 1, 1);
        }
        else if (_dirMVec.x < 0)
        {
            _prefabs.transform.localScale = new Vector3(1, 1, 1);
        }
    }
Exemplo n.º 2
0
    IEnumerator Attack()
    {
        isAttack = true;
        animationController.PlayAnimation(4);

        yield return(new WaitForSeconds(player.transform.GetChild(0).GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).length));

        isAttack = false;
    }
Exemplo n.º 3
0
    IEnumerator Idle()
    {
        unitObject.PlayAnimation((int)State.Idle);

        yield return(null);
    }