// ********************* TileAbility stuff public void FireTrigger(TileAbility.PlayerTurnStateTriggers trigState, PlayerBoard plr) { TileAbility[] abilityList = GetComponents<TileAbility>(); foreach(TileAbility ability in abilityList) { ability.FireTrigger(trigState, plr); } }
public void EndTurn() { GameState.Message(this.name + " turn has ended"); this.gameObject.SetActive(false); // End of Turn Triggers foreach (Tile tile in tileList) { TileAbility ability = tile.GetComponent <TileAbility>(); if (ability) { // Herder ability. If the player has locked a pair, then give the player a die for the remainder of the turn. if (ability.onStateTrigger == TileAbility.PlayerTurnStateTriggers.LockedAny) { } } } // remove all temporary tiles. RemoveAllTempTiles(); // for all dice - remove all temporary dice for (int ii = diceList.Count - 1; ii >= 0; ii--) // reverse remove so we don't get weird list problems { PharoahDie d6 = diceList[ii]; if (d6.isTemporary()) // remove temporary dice { diceList.RemoveAt(ii); // take this die out of this list Destroy(d6.gameObject); // destroy this whole die. } } /* * foreach (PharoahDie d6 in diceList) * { * if (d6.isTemporary()) // remove temporary dice * { * diceList.Remove(d6); * Destroy(d6.gameObject); * } * } */ // for all dice - reset all permanent dice foreach (PharoahDie d6 in diceList) { d6.ReadyToRoll(); d6.EndTurn(); d6.transform.parent = this.transform; } foreach (Tile tile in tileList) { tile.canUndo = false; } pgs.SetState(PlayerGameState.PlayerGameStates.WaitingNextTurn); }
// this is a die we just purchased. We can't do anything with it. public void PurchasedDie(TileAbility purchaser) { //specialAbility[0] = purchaser; // this die remembers which tile purchased it in case the die needs a special ability. specialAbility = purchaser.GetComponents <TileAbility>(); foreach (TileAbility ability in specialAbility) { ability.SetMyDie(this); } isLocked = true; isTempLocked = true; this.MoveToDiceCupArea(); CannotSelect(); //this.gameObject.SetActive(false); }
// ======================================================================================== // dice stuff public int GetNumValidDice(TileAbility.DieType onlyDieType) { int nDice = 0; foreach(PharoahDie die in diceList) { if (die.isDieType(onlyDieType)) { nDice++; } } return nDice; }
// ***************** Tile ability stuff public void FireTriggers(TileAbility.PlayerTurnStateTriggers trigState) { // all of the tiles that the player owns are now triggered foreach (Tile tile in tileList) { tile.FireTrigger(trigState, this); } // all of the dice which may have special abilities are triggered too foreach(PharoahDie die in this.diceList) { foreach (TileAbility ability in die.specialAbility) { ability.FireTrigger(trigState, this); } } }