public static float getMinionSpeed(MinionColor color, bool isIdle) { float speed = 0f; switch(color) { case MinionColor.BLUE: speed = MINION_SPEED_IDLE_BLUE; break; case MinionColor.GREEN: speed = MINION_SPEED_IDLE_GREEN; break; case MinionColor.RED: speed = MINION_SPEED_IDLE_RED; break; case MinionColor.YELLOW: speed = MINION_SPEED_IDLE_YELLOW; break; default: return 0f; } if(isIdle == true) { return speed; } else { return speed * MINION_SPEED_MULTIPLICATOR; } }
private void Initialize(MinionColor color, int count) { for (int i = 0; i < count; i++) { Minion minion = Game.instance.CreateMinion(color); _minions.Add(minion); } }
public static int getPoints(MinionColor color) { switch(color) { case MinionColor.BLUE: return BLUE_POINT; case MinionColor.GREEN: return GREEN_POINT; case MinionColor.RED: return RED_POINT; case MinionColor.YELLOW: return YELLOW_POINT; default: return 0; } }
public static TileType getTileTypeForColor(MinionColor color) { switch(color) { case MinionColor.BLUE: return TileType.MINION_BLUE; case MinionColor.GREEN: return TileType.MINION_GREEN; case MinionColor.RED: return TileType.MINION_RED; case MinionColor.YELLOW: return TileType.MINION_YELLOW; default : return TileType.DEFAULT; } }
// Return the total of minions of the player public int GetCountMinions(MinionColor color) { switch(color) { case MinionColor.BLUE: return this.GetCountMinionsBlue (); case MinionColor.GREEN: return this.GetCountMinionsGreen (); case MinionColor.RED: return this.GetCountMinionsRed (); case MinionColor.YELLOW: return this.GetCountMinionsYellow (); default : return this._minions.Count; } }
public List<Minion> GetMinions(MinionColor color) { if(color == MinionColor.ANY) { return this.minions; } else { List<Minion> minions = new List<Minion> (); foreach(Minion minion in this._minions) { if(minion.color == color) { minions.Add (minion); } } return minions; } }
// Return one minion of the selected color public Minion GetMinion(MinionColor color) { switch(color) { case MinionColor.BLUE: return this.GetOneMinionBlue(); case MinionColor.GREEN: return this.GetOneMinionGreen (); case MinionColor.RED: return this.GetOneMinionRed(); case MinionColor.YELLOW: return this.GetOneMinionYellow(); default: return this.GetRandomMinion(); } }
// Kill one minion, without trigger his effect public void KillMinion(MinionColor color) { Minion minion = this.GetMinion (color); this._minions.Remove (minion); minion.Kill (); portrait.GetComponent<PlayerUI>().FillMinionSlots(this.minions); }
// Sacrifice a minion to get a bonus/special action public void SacrificeMinion(MinionColor color) { if(this.canAction == true && this.GetCountMinions (color) > 0) { // Todo : A décommenter Minion minion = this.GetMinion(color); if (minion.canSacrifice == true) { Game.instance.numberOfTurnSinceRespawn = 0; this.RemoveMinion(color); minion.Sacrifice(); portrait.GetComponent<PlayerUI>().FillMinionSlots(this.minions); } else { Game.instance.PrepareEndTurn(); } } }
// Remove a minion from the player public void RemoveMinion(MinionColor color) { if (this._minions.Count > 0) { Minion minionToRemove = null; foreach (Minion minion in this._minions) { if (minion.color == color) { minionToRemove = minion; break; } } if (minionToRemove != null) { this._minions.Remove (minionToRemove); for(int i = 0; i < this.minions.Count; i++) { minions[i].setMinionOffset (i); minions[i].transform.position = this.transform.position + Game.instance.mapManager.map.tiles [this.tileIndex].size / 2.5f * minions[i].offsetPosition; minions[i].targetPosition = minions[i].transform.position; } #if DEBUG Debug.Log ("One minion with color " + minionToRemove.color + " has been removed"); #endif } else { #if DEBUG Debug.Log ("ERROR NO MINION WITH COLOR " + color + " FOUND !"); #endif } } else { #if DEBUG Debug.Log ("The player hasn't any minions."); #endif } }
// Create a minion public Minion CreateMinion(MinionColor color) { Minion.number++; switch(color) { case MinionColor.BLUE: return Instantiate (this._minionBlue) as MinionBlue; case MinionColor.GREEN: return Instantiate (this._minionGreen) as MinionGreen; case MinionColor.RED: return Instantiate (this._minionRed) as MinionRed; case MinionColor.YELLOW: return Instantiate (this._minionYellow) as MinionYellow; default: MinionColor randomColor = (MinionColor) Random.Range (1, System.Enum.GetValues(typeof(MinionColor)).Length); return this.CreateMinion (randomColor); } }