コード例 #1
0
    public override void execute(AbstractEnemyAI enemyAI)
    {
        if (enemyAI.reachedEndOfPath || enemyAI.canSeePlayer)
        {
            Executing = false;
        }

        enemyAI.AstarMoveToTarget();
    }
コード例 #2
0
    public override void execute(AbstractEnemyAI enemyAI)
    {
        if (Executing && !conditionsMet(enemyAI))
        {
            Executing = false;
        }

        enemyAI.AstarMoveToTarget();

        if (enemyAI.reachedEndOfPath)
        {
            enemyAI.targetPosition = currentRoom.GetRandomPointInRoom(0, 0);
        }
    }
コード例 #3
0
ファイル: ChaseState.cs プロジェクト: Blukzen/Dungrena
    public override void execute(AbstractEnemyAI enemyAI)
    {
        // If can see player update path to player and move towards.
        if (enemyAI.canSeePlayer && !enemyAI.CanAttackTarget())
        {
            if (GameManager.player == null)
            {
                return;
            }

            enemyAI.targetPosition = GameManager.player.transform.position;

            enemyAI.AstarMoveToTarget();
        }

        // If reached end of path and cannot see player stop executing ChaseState.
        else
        {
            enemyAI.targetPosition = transform.position;
            Executing = false;
        }
    }