//returns true if given item or trap is in this node and removes it, or else returns false public bool RemoveTrapOrItem(TrapOrItem toiToRemove) { if (trapsOrItemsInThisNode.Contains(toiToRemove)) { trapsOrItemsInThisNode.Remove(toiToRemove); return(true); } else { return(false); } }
public void spell_landMine(int playerId, Vector3 selectedNodePos) { Node selectedNode = grid.NodeFromWorldPoint(selectedNodePos); if (selectedNode.GetUnit() == null) // check if there's a unit on this node { TrapOrItem landMine = new TrapOrItem(playerId, 0, 0, 0, TrapOrItem.TrapOrItemTypes.LandMine); selectedNode.AddTrapOrItem(landMine); if (!GameManager.instance.networked || PhotonView.Get(gameObject).IsMine) { TurnManager.instance.updateGameHistory("Player " + playerId + " placed a Land Mine on the battlefield!\n"); TurnManager.instance.updateTurnUpdate("Successfully placed a Land Mine!", TurnManager.instance.color32_green); } TurnManager.instance.cardSuccessful = true; } else { if (!GameManager.instance.networked || PhotonView.Get(gameObject).IsMine) { TurnManager.instance.updateTurnUpdate("Cannot place a Bear on a cell that has a unit on it!", TurnManager.instance.color32_red); } } }
//adds the trap or item to node public void AddTrapOrItem(TrapOrItem toiToAdd) { trapsOrItemsInThisNode.Add(toiToAdd); }