/// <summary> /// Fires when the board ability is used from a card /// </summary> /// <param name="boardAbility">The board ability that is being used</param> public void StartBoardAbility(CardBoardAbility boardAbility) { this._currentBoardAbility = boardAbility; // Only start the targeting shading if it is not an automatic board target if (this._currentBoardAbility.NeedBoardTarget) { this.IsBoardTargeting = true; this._selectionsLeft = this._currentBoardAbility.NumOfSelections; foreach (OrbGem orb in this.orbs) { if (!orb.IsTargeted) { orb.SetColor(Color.gray); } } // Selecting the upper left gem for default targeting OrbGem og = this.orbs.FirstOrDefault(o => o.Loc.x == 0 && o.Loc.y == 0); this.SetupTarget(og); } else { switch (this._currentBoardAbility.BoardAbilityTarget) { case BoardAbilityData.BoardTargetType.Color: this._currentBoardAbility.ActivateAbility(this.orbs.FindAll(x => x.CellType == _currentBoardAbility.TargetColor)); break; case BoardAbilityData.BoardTargetType.RandomSelection: this._currentBoardAbility.ActivateAbility(this.GetRandomOrbSelection(this._currentBoardAbility.NumOfSelections)); break; case BoardAbilityData.BoardTargetType.All: this._currentBoardAbility.ActivateAbility(this.orbs); break; default: Debug.LogError("Error: Didn't recognize target type as either manual or automatic selection"); break; } this._currentBoardAbility = null; } }
public void StartBoardAbility(CardBoardAbility boardAbility) { if (this.puzzleOrbBoard == null) { return; } this.puzzleOrbBoard.StartBoardAbility(boardAbility); }