示例#1
0
    private void patrol()
    {
        m_path = null;
        TDWorld world = TDWorld.getWorld();

        GameObject [] aEnemies = world.getAllEnemiesUnsafe();
        foreach (GameObject enemy in aEnemies)
        {
            if ((enemy.transform.position - transform.position).magnitude < world.m_configuration.heroPatrolRadius)
            {
                TDEnemy tdEnemy = world.getTDEnemy(enemy);
                if (tdEnemy.canFly())
                {
                    continue;
                }
                if (hasPathTo(enemy))
                {
                    m_state = State.eWalk;
                    break;
                }
            }
        }
    }