Пример #1
0
    // Start is called before the first frame update
    void Update()
    {
        if (gameManager.currentTurnStage == TurnStage.enemyMoveTurn)
        {
            //MOVING VIA UPDATE
            if (canMove)
            {
                position = transform.position;


                Move();
            }

            if (moving)
            {
                if (transform.position == position)
                {
                    moving  = false;
                    canMove = true;


                    Move();
                }
            }
        }
        else if (gameManager.currentTurnStage == TurnStage.enemyAttackTurn)
        {
            if (Physics2D.OverlapCircle(enemyAttackPoint.position, 0.2f, whatCanBeAttacked))
            {
                playerCollider = Physics2D.OverlapCircle(enemyAttackPoint.position, 0.2f, whatCanBeAttacked);

                StartCoroutine(enemyAnimations.AnimateWhenMoving());
                //check update the list of -- trigger list uopdaTE
            }
            else
            {
                EventManager.TriggerEvent("endEnemyAttackStage");
            }
        }
        else
        {
            EventManager.TriggerEvent("enemyWaitAnimation");
        }

        transform.position = Vector3.MoveTowards(transform.position, position, Time.deltaTime * moveSpeed);
    }