private void CreateMove() { GameMove gameMove = new GameMove(leavingSpot, landingSpot, gameObject); GameManager.Singleton.HandleNewMove(gameMove); //gameMove.Execute(); //GameManager.OnValidMove?.Invoke(); }
/// <summary> /// Turn the card on top of the covered part of the pile, if there's one available and it's not flipped already. /// </summary> public void TurnNextCard() { if (currentPile.Count > 0) { var lastCard = currentPile.Last.Value; if (!lastCard.GetComponent <Card>().IsFaceUp) { GameMove gameMove = new GameMove(this, this, lastCard); GameManager.Singleton.HandleNewMove(gameMove); } } }
public void HandleNewMove(GameMove move) { movesList.Push(move); AddPointsToScore(move.PointsAwarded); if (move.MoveType == MoveType.RECYCLE_WASTE) { AddPointsToScore(-100); } if (move.MoveType != MoveType.FLIP) { Moves++; // a flip is always associated to another move. So, increasing the counter will be done by the associated move; } move.Execute(); OnValidMove?.Invoke(); }
public void UndoMove(GameMove moveToUndo) { switch (moveToUndo.MoveType) { case MoveType.FETCH_CARD: { UndoFetchCard(moveToUndo.Card); break; } case MoveType.RECYCLE_WASTE: { StartCoroutine(UndoRecycleWaste()); break; } default: { Debug.LogError("[Deck] the move to undo doesn't belong to this object"); break; } } }
public void ExecuteMove(GameMove moveToExecute) { switch (moveToExecute.MoveType) { case MoveType.FETCH_CARD: { FetchCard(); break; } case MoveType.RECYCLE_WASTE: { StartCoroutine(RecycleWaste()); break; } default: { Debug.LogError("[Deck] the move to execute doesn't belong to this object"); break; } } }
public void ChooseButtonAction() { if (availableCards.Count == 0 && currentWastePile.Count == 0) { return; } GameMove gameMove; if (availableCards.Count == 0 && currentWastePile.Count > 0) { // create a "RecreateStock" Move gameMove = new GameMove(this, this, null); } else { //availableCardIndex = availableCardIndex - 1 < 0 ? availableCards.Count - 1 : availableCardIndex - 1; //lastCardFetched = DeckTopCard; // only for showing in the inspector gameMove = new GameMove(this, this, DeckTopCard); } // If there are still available cards, show a covered card sprite GameManager.Singleton.HandleNewMove(gameMove); deckImage.sprite = availableCards.Count > 0 ? deckSprites[0] : deckSprites[1]; }