Example #1
0
    public override void Update(EnemyScript enemy)
    {
        Collider2D player = enemy.PlayerInFielOfView();

        if (player != null)
        {
            if (enemy.IsOnPlatform())
            {
                enemy.ChasePlayer(player);
            }
            else
            {
                //powrót do patrolowania
                enemy.FlipEnemy(enemy.direction * -1);
                ChangeState(enemy, enemy.patrolState);
            }
        }
        else
        {
            //powrót do patrolowania
            ChangeState(enemy, enemy.patrolState);
        }
    }