public void SetPlayableSpaces() { foreach (PlayableSpot spot in PlayableSpots) { ObjectPooler.ReturnObject <PlayableSpot>(spot); } PlayableSpots.Clear(); HashSet <Coordinate> validPlayableSpaces = CurrentPlayField.GetValidPlayableSpaces(); foreach (Coordinate curCoordinate in validPlayableSpaces) { GeneratePlayableSpot(curCoordinate); } UpdateValidityOfPlayableSpots(null); }
public bool TryRemoveCardAtCoordinate(Coordinate toRemove, out PlayingCard foundCard) { foundCard = PlayedCards.FirstOrDefault(card => card.OnCoordinate == toRemove); if (foundCard == null) { return(false); } PlayedCards.Remove(foundCard); CurrentPlayField.RemoveCard(toRemove); HashSet <Coordinate> playableSpaces = CurrentPlayField.GetValidPlayableSpaces(); foreach (PlayingCard card in PlayedCards) { card.SetHappiness(CurrentPlayField.ShouldCoordinateBeHappy(card.OnCoordinate)); card.SetIncompleteness(CurrentPlayField.ShouldCoordinateBeIncompletable(card.OnCoordinate)); } SetPlayableSpaces(); return(true); }