Exemplo n.º 1
0
    public static bool InAlertStatus()
    {
        if (ObjectContainer.instance)
        {
            List <GameObject> enemies = ObjectContainer.GetAllEnemies();

            foreach (GameObject enemy in enemies)
            {
                AutoMover mover = enemy.GetComponent <AutoMover>();
                if (mover && mover.awareness == State.Alert)
                {
                    return(true);
                }
            }
        }

        return(false);
    }
Exemplo n.º 2
0
    private void SpawnEnemies(int numEnemies)
    {
        for (int i = 0; i < height; ++i)
        {
            for (int j = 0; j < width; ++j)
            {
                Vector2 cell = new Vector2(i, j);
                if (Vector2.Distance(new Vector2(2, 2), cell) > 1)
                {
                    SpawnEnemy(new Vector2(i, j));
                }
            }
        }

        int numToDelete = (height * width) - numEnemies - 5;

        for (int i = 0; i < numToDelete; ++i)
        {
            List <GameObject> enemyList     = ObjectContainer.GetAllEnemies();
            GameObject        enemyToDelete = enemyList[PRNG.Range(0, enemyList.Count)];
            DestroyImmediate(enemyToDelete);
        }
    }