Ejemplo n.º 1
0
    public static void GenerateObjective(Room r)
    {
        Dictionary <Entity.Entities, GameObject> enemyPrefabs = GameController.instance.GetEntitiesPrefabs(); // TODO not so cool

        Objective o = null;

        int rand = UnityEngine.Random.Range(0, 8);

        switch (rand)
        {
        case 0:
        case 7:
        {
            // Scorpion Attack!!!!:
            List <GameObject> lg = new List <GameObject>();
            int count            = UnityEngine.Random.Range(1, ( int )Math.Min(Mathf.Floor(r.GetSpawnpoints().Count), 4));
            for (int c = 0; c < count; c++)
            {
                lg.Add(enemyPrefabs[Entity.Entities.SCORPION]);
            }
            EntityObjective eo = new EntityObjective(r, lg);
            o = eo;
        }
        break;

        case 2:
        case 3: {
            // Bug Attack!!!!:
            List <GameObject> lg = new List <GameObject>();
            int count            = Math.Min(UnityEngine.Random.Range(1, ( int )Mathf.Floor(r.GetSpawnpoints().Count)), 7);
            for (int c = 0; c < count; c++)
            {
                lg.Add(enemyPrefabs[Entity.Entities.BUG]);
            }
            EntityObjective eo = new EntityObjective(r, lg);
            o = eo;
        }
        break;

        case 4:
        case 5:
        {
            // Coins!!!!:
            List <GameObject> lg = new List <GameObject>();
            int count            = Math.Min(UnityEngine.Random.Range(1, (int)Mathf.Floor(r.GetSpawnpoints().Count)), 20);
            for (int c = 0; c < count; c++)
            {
                lg.Add(enemyPrefabs[Entity.Entities.COIN]);
            }
            EntityObjective eo = new EntityObjective(r, lg);
            o = eo;
        }
        break;

        case 6:
        case 1:
        {
            // Siders!!!!:
            List <GameObject> lg = new List <GameObject>();
            int count            = Math.Min(UnityEngine.Random.Range(1, (int)Mathf.Floor(r.GetSpawnpoints().Count)), 5);
            for (int c = 0; c < count; c++)
            {
                lg.Add(enemyPrefabs[Entity.Entities.SPIDER]);
            }
            EntityObjective eo = new EntityObjective(r, lg);
            o = eo;
        }
        break;
        }

        r.SetObjective(o);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the Objective this Entity is associated with.
 /// </summary>
 /// <param name="obj">Objective</param>
 public void SetObjective(EntityObjective obj)
 {
     objective = obj;
 }