//any code after this is <<outside>> of "Update" public bool canSpawnMinion(Minion.Allegiance allegiance) { if (allegiance == Minion.Allegiance.RED) { if (redminion >= maxred) { return(false); } else { return(true); } } if (allegiance == Minion.Allegiance.BLUE) { if (blueminion >= maxblue) { return(false); } else { return(true); } } return(false); }
public void towerHasBeenAttacked(Minion m) { // Handle different behaviors based on tower allegiance switch (m_teamAllegiance) { case Minion.Allegiance.NEUTRAL: { // Any team will reduce the tower's armor m_towerArmor -= 1; if (m_towerArmor < 0) { if (m.miniononplayerteam) { m_teamAllegiance = Minion.Allegiance.BLUE; handleAllegianceSwap(); } else { m_teamAllegiance = Minion.Allegiance.RED; handleAllegianceSwap(); } } } break; case Minion.Allegiance.BLUE: { // Only red minions can reduce a blue tower's armor if (m.miniononplayerteam == false) { m_towerArmor -= 1; } if (m_towerArmor <= 0) { m_teamAllegiance = Minion.Allegiance.RED; handleAllegianceSwap(); } } break; case Minion.Allegiance.RED: { // Only blue minions can reduce a red tower's armor if (m.miniononplayerteam == true) { m_towerArmor -= 1; } if (m_towerArmor <= 0) { m_teamAllegiance = Minion.Allegiance.BLUE; handleAllegianceSwap(); } } break; } }
// Tell the Gameplay script that a new minion was added // This handles the case where a minion is added in between Update() calls public void notifyOfNewSpawn(Minion.Allegiance allegiance) { if (allegiance == Minion.Allegiance.RED) { redminion++; } else if (allegiance == Minion.Allegiance.BLUE) { blueminion++; } }