Пример #1
0
    //[Button]
    void Update()
    {
        if (isTurn && !isLocked)
        {
            if (state == CharacterSate.Moving)
            {
                if (currentTile.transform.position != transform.position)
                {
                    Move();
                    arrows.HideArrows();
                    hasMoved = true;
                }
                else
                {
                    CollectPickUp();
                    WaitIfNotAttack();
                }
            }
            else if (state == CharacterSate.Waiting)
            {
                WaitIfNotAttack();

                if (type == CharacterType.Player)
                {
                    arrows.ShowArrows(currentTile);
                }
                else if (type == CharacterType.IA)
                {
                    MoveTo((DirectionType)Random.Range(0, 4));
                }
            }
            else if (state == CharacterSate.Fighting)
            {
                arrows.HideArrows();
            }
        }
        else
        {
            transform.position = currentTile.transform.position;
            state = CharacterSate.Waiting;
            arrows.HideArrows();
            enemy    = null;
            attack   = settings.Attack;
            hasMoved = false;
        }
    }