// does actions if player is a winner public void Winner(Player winner) { speedState = gameState.Winner; yourName.Fade(4); oppName.Fade(4); yourScore.Fade(4); oppScore.Fade(4); if (myType == gameType.Levels) { levelss.Fade(4); } for (int i = 0; i < yourCards.Length; i++) { if (yourCards[i].Count() != 0) { yourCards[i].Take().Fade(4); } if (opponentCards[i].Count() != 0) { opponentCards[i].Take().Fade(4); } } while (yourStack.Count() != 0) { yourStack.Take().Fade(4); } while (opponentStack.Count() != 0) { opponentStack.Take().Fade(4); } if (winner == null) { Tie(); } else if (winner.isPlayer1) { YourAWinner(); } else { OppAWinner(); } }
// draws card to different piles public void DrawCard(Pile drawPile, Pile destinationPile, float delay) { if (destinationPile.drawnTo) { return; } ableToReBegin = false; destinationPile.drawnTo = true; Card temp = null; switch (myType) { case gameType.Levels: case gameType.Normal: temp = drawPile.Take(); break; case gameType.Marathon: case gameType.Timed: temp = getRandomCard(drawPile); base.Add(temp); break; } temp.Flip(true, delay); temp.toPile(destinationPile, delay); if (destinationPile.hasPowerUp) { destinationPile.RemovePowerUp(); } temp.WhenDoneMoving(delegate() { destinationPile.drawnTo = false; Timer drawTimer = new Timer(1); base.Add(drawTimer); drawTimer.SetTimer(0, .5f, delegate() { ableToReBegin = true; }); if ((destinationPile == lGameStack || destinationPile == rGameStack) && !destinationPile.hasPowerUp) { SelectPowerUp(destinationPile); } }); }
// draws card to different piles public void DrawCard(Pile drawPile, Pile destinationPile, float delay) { if (destinationPile.drawnTo) return; ableToReBegin = false; destinationPile.drawnTo = true; Card temp = null; switch (myType) { case gameType.Levels: case gameType.Normal: temp = drawPile.Take(); break; case gameType.Marathon: case gameType.Timed: temp = getRandomCard(drawPile); base.Add(temp); break; } temp.Flip(true, delay); temp.toPile(destinationPile, delay); if (destinationPile.hasPowerUp) destinationPile.RemovePowerUp(); temp.WhenDoneMoving(delegate() { destinationPile.drawnTo = false; Timer drawTimer = new Timer(1); base.Add(drawTimer); drawTimer.SetTimer(0, .5f, delegate() { ableToReBegin = true; }); if ((destinationPile == lGameStack || destinationPile == rGameStack) && !destinationPile.hasPowerUp) SelectPowerUp(destinationPile); }); }