Beispiel #1
0
    /// <summary>
    /// OnTriggerEnter is called when the Collider other enters the trigger.
    /// </summary>
    /// <param name="other">The other Collider involved in this collision.</param>
    void OnTriggerEnter(Collider other)
    {
        // Debug.Log("GoalZone:" + other.name);
        Creep    creep    = other.GetComponent <Creep>();
        CreepNav creepNav = other.GetComponent <CreepNav>();

        if (creep != null)
        {
            creep.DieVictoriously();
        }
        if (creepNav != null)
        {
            creepNav.DieVictoriously();
        }
        // if (creepManager.getActiveCreeps().Contains(other.gameObject))
        // {
        //  Creep creep = other.GetComponent<Creep>();
        //  CreepNav creepNav = other.GetComponent<CreepNav>();
        //  if (creep != null)
        //  {
        //      creep.DieVictoriously();
        //  }
        //  if (creepNav != null)
        //  {
        //      creepNav.DieVictoriously();
        //  }
        // }
    }
Beispiel #2
0
    void spawnSingleCreep(int wave)
    {
        // spawn creep at index (wave mod (however many creeps i have - 1))
        // spawn creep at wheretospawn.
        // add creep to list of active creeps
        // If we start repeating the same enemies then we need to start incrimenting their health higher and higher. this is where that should be done
        GameObject x = Instantiate(creeps[wave % numberOfUniqueCreepTypes], whereToSpawn.position, whereToSpawn.rotation) as GameObject;

        CM.addCreepToActiveList(x);
        Creep    creep    = x.GetComponent <Creep>();
        CreepNav creepNav = x.GetComponent <CreepNav>();

        if (creep != null)
        {
            creep.SetHealth(wave * creep.healthIncrement);
            creep.SetMaxHealth(creep.GetHealth());
            creep.SetSpeed(Random.Range(-1, 1));
            creep.corners = movePointsforCreeps;
        }
        if (creepNav != null)
        {
            creepNav.SetHealth(wave * creepNav.healthIncrement);
            creepNav.SetMaxHealth(creepNav.GetHealth());
            creepNav.SetSpeed(Random.Range(-1, 1));
            creepNav.corners = movePointsforCreeps;
        }
        x.name = "Goblin" + names.ToString();
        names++;
    }
Beispiel #3
0
 void Start()
 {
     creep    = GetComponent <Creep>();
     creepNav = GetComponent <CreepNav>();
 }