Example #1
0
 public static void Prefix()
 {
     if (GameWinner != null)
     {
         TempData.winners = GameWinner.GetWinners(customRoles);
     }
 }
Example #2
0
    void OnPlayerDeath(PlayerScript player)
    {
        ui.ShowBigStatusBar("RIP " + player.chefType + " chef", 2f);

        if (playersAlive == 0)
        {
            gameover = true;
            winner   = GameWinner.HORDE;
            OnGameOver(GameWinner.HORDE);
        }
    }
 //PUT IN TITLE SCENE on empty game object
 private void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
        public IActionResult PostWinner([FromBody] GameWinner model)
        {
            bool result = _userService.AddWonGame(model);

            if (!result)
            {
                return(new ObjectResult("Error when saving winner.")
                {
                    StatusCode = 409
                });
            }

            return(Ok());
        }
Example #5
0
 /// <summary>
 /// Indicates if the given tile and winner are equal
 /// </summary>
 /// <param name="tile">The tile</param>
 /// <param name="winner">The winner</param>
 public static bool AreEqual(BoardTileType tile, GameWinner winner)
 {
     if (tile == BoardTileType.Circle && winner == GameWinner.Circle)
     {
         return(true);
     }
     else if (tile == BoardTileType.Cross && winner == GameWinner.Cross)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #6
0
 /// <summary>
 /// Calculates the score
 /// </summary>
 /// <param name="player">The player</param>
 /// <param name="winner">The winner</param>
 private int Score(BoardTileType player, GameWinner winner)
 {
     if (winner == GameWinner.Tie)
     {
         return(0);
     }
     else if (Board.AreEqual(player, winner))
     {
         return(10);
     }
     else
     {
         return(-10);
     }
 }
Example #7
0
    void TurnInfoGui()
    {
        if (IsGameOver)
        {
            if (!_displayedGameOver)
            {
                _displayedGameOver = true;
                GameoverPanel.SetActive(true);

                GameoverPanel.GetComponent <Image>().color = GameWinner == "White" ? Color.white : Color.black;

                var gameOverText = GameObject.Find("Gameover Text").GetComponent <Text>();
                gameOverText.color = GameWinner == "White" ? Color.black : Color.white;

                var winner = GameObject.Find("Winner").GetComponent <Text>();
                winner.color = GameWinner == "White" ? Color.black : Color.white;
                winner.text  = GameWinner.ToUpper();

                var gameResult = GameObject.Find("Game Result").GetComponent <Text>();
                gameResult.color = GameWinner == "White" ? Color.black : Color.white;
                gameResult.text  = GameResult;
            }
        }
        else if (!CanPlay)
        {
            _displayedGameOver = false;

            if (IsComputerTurn)
            {
                SkipTurn();
            }
            else
            {
                SkipTurnPanel.SetActive(true);
                SkipTurnPanel.GetComponentInChildren <Text>().text = CannotPlayMessage;
            }
        }
        else
        {
            _displayedGameOver = false;

            if (!PlayerTurn.text.StartsWith(Player.ToUpper()))
            {
                PlayerTurn.text  = Player.ToUpper();
                PlayerTurn.color = Player == "Black" ? Color.black : Color.white;
            }
        }
    }
Example #8
0
        /// <summary>
        /// Marks that the game is over
        /// </summary>
        /// <param name="winner">The winner</param>
        private void GameOver(GameWinner winner)
        {
            this.isOver = true;

            switch (winner)
            {
            case GameWinner.Tie:
                this.StatusLabel.Text = "The game is over. It's a tie.";
                break;

            case GameWinner.Cross:
                this.StatusLabel.Text = "The game is over. Cross wins.";
                break;

            case GameWinner.Circle:
                this.StatusLabel.Text = "The game is over. Circle wins.";
                break;
            }
        }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        if ((tutorialImage.enabled && state == GameState.PREP) && (Input.GetKeyDown(KeyCode.P) || InputManager.ActiveDevice.Action1.WasPressed))
        {
            tutorialImage.enabled = false;
            ChangeState(GameState.PREP);
        }

        if (state == GameState.PLAY && !gameover)
        {
            if (horde.isSpawning)
            {
                waveIndicator.ChangeText("SPAWNING " + horde.zombiesAlive + "/" + horde.zombiesTotal);
            }
            else
            {
                waveIndicator.ChangeText("LEFT: " + horde.zombiesAlive + "/" + horde.zombiesTotal);
            }

            if (horde.zombiesAlive == 0 && !horde.isSpawning)
            {
                // zombies are dead!
                // next wave
                wave++;

                Debug.Log("wave " + wave + " of " + currentMap.waves.Length);

                // all waves are done
                if (wave >= currentMap.waves.Length)
                {
                    gameover = true;
                    OnGameOver(GameWinner.PLAYERS);
                    winner = GameWinner.PLAYERS;
                }
                else
                {
                    ChangeState(GameState.PREP);
                }
            }
        }
    }
        public bool AddWonGame(GameWinner model)
        {
            AppUser user = _context.Users.Where(u => u.UserName == model.UserName).FirstOrDefault();

            if (user == null)
            {
                return(false);
            }

            if (model.Multiplayer)
            {
                user.WonMultiplayerGames++;
            }
            else
            {
                user.WonAiGames++;
            }

            _context.SaveChanges();
            return(true);
        }
Example #11
0
 private void Awake()
 {
     gameWinner = new GameWinner(winnerText);
     stoneCount = new StoneCount(blockCountText);
     turnTexts  = new TurnText(turnText);
 }
Example #12
0
 public bool AddWonGame(GameWinner model)
 {
     return(_userRepo.AddWonGame(model));
 }
Example #13
0
 void OnGAMEOVER(GameWinner winner)
 {
     // go to the end screen after a couple seconds
     StartCoroutine(DelayEndScreen());
 }
Example #14
0
    public void HighlightWinnerBestCards(GameWinner winner)
    {
        SoundManager.Instance.PlayGameCompleteSound(Camera.main.transform.position);

        for (int i = 0; i < winner.Winner_Best_Cards.Count; i++)
        {
            if (card1.Equals(winner.Winner_Best_Cards [i]))
            {
//                Vector2 pos = card1Position.GetChild (0).position;
//				pos.y += 10f;
//				card1Position.GetChild (0).position = pos;

                if (card1Position.childCount > 0)
                {
                    UpCard(card1Position.GetChild(0).gameObject, 10f);
                }
            }
            else if (card2.Equals(winner.Winner_Best_Cards [i]))
            {
//                Vector2 pos = card2Position.GetChild (0).position;
//				pos.y += 10f;
//				card2Position.GetChild (0).position = pos;

                if (card2Position.childCount > 0)
                {
                    UpCard(card2Position.GetChild(0).gameObject, 10f);
                }
            }
        }

        for (int i = 0; i < winner.Winner_Best_Cards.Count; i++)
        {
            if (TexassGame.Instance.defaultCardsPositionList [i].childCount == 0)
            {
                continue;
            }

            if (winner.Winner_Best_Cards [i].Equals(TexassGame.Instance.texassDefaultCards.Flop1))
            {
//				Vector2 pos = TexassGame.Instance.defaultCardsPositionList [0].GetChild (0).transform.position;
//				pos.y += 15f;
//				TexassGame.Instance.defaultCardsPositionList [0].GetChild (0).transform.position = pos;

                if (TexassGame.Instance.defaultCardsPositionList [0].childCount > 0)
                {
                    UpCard(TexassGame.Instance.defaultCardsPositionList [0].GetChild(0).gameObject, 15f);
                }
            }
            else if (winner.Winner_Best_Cards [i].Equals(TexassGame.Instance.texassDefaultCards.Flop2))
            {
//				Vector2 pos = TexassGame.Instance.defaultCardsPositionList [1].GetChild (0).transform.position;
//				pos.y += 15f;
//				TexassGame.Instance.defaultCardsPositionList [1].GetChild (0).transform.position = pos;

                if (TexassGame.Instance.defaultCardsPositionList [1].childCount > 0)
                {
                    UpCard(TexassGame.Instance.defaultCardsPositionList [1].GetChild(0).gameObject, 15f);
                }
            }
            else if (winner.Winner_Best_Cards [i].Equals(TexassGame.Instance.texassDefaultCards.Flop3))
            {
//				Vector2 pos = TexassGame.Instance.defaultCardsPositionList [2].GetChild (0).transform.position;
//				pos.y += 15f;
//				TexassGame.Instance.defaultCardsPositionList [2].GetChild (0).transform.position = pos;

                if (TexassGame.Instance.defaultCardsPositionList [2].childCount > 0)
                {
                    UpCard(TexassGame.Instance.defaultCardsPositionList [2].GetChild(0).gameObject, 15f);
                }
            }
            else if (winner.Winner_Best_Cards [i].Equals(TexassGame.Instance.texassDefaultCards.Turn))
            {
//				Vector2 pos = TexassGame.Instance.defaultCardsPositionList [3].GetChild (0).transform.position;
//				pos.y += 15f;
//				TexassGame.Instance.defaultCardsPositionList [3].GetChild (0).transform.position = pos;

                if (TexassGame.Instance.defaultCardsPositionList [3].childCount > 0)
                {
                    UpCard(TexassGame.Instance.defaultCardsPositionList [3].GetChild(0).gameObject, 15f);
                }
            }
            else if (winner.Winner_Best_Cards [i].Equals(TexassGame.Instance.texassDefaultCards.River))
            {
//				Vector2 pos = TexassGame.Instance.defaultCardsPositionList [4].GetChild (0).transform.position;
//				pos.y += 15f;
//				TexassGame.Instance.defaultCardsPositionList [4].GetChild (0).transform.position = pos;

                if (TexassGame.Instance.defaultCardsPositionList [4].childCount > 0)
                {
                    UpCard(TexassGame.Instance.defaultCardsPositionList [4].GetChild(0).gameObject, 15f);
                }
            }
        }

//		BlinkPlayer ();
    }
Example #15
0
        private void HandleLeadChange(GameWinner prev, GameWinner curr)
        {
            // if the  status has changed and there was a pitcher in line for a save, he can't be anymore
            savePitcher = null;

            if (curr == GameWinner.TieScore)
            {
                winningPitcher = null;
                losingPitcher = null;
            }
            else if (curr == GameWinner.HomeTeam)
            {
                winningPitcher = homeTeam.CurrentPitcher;
                losingPitcher = visitingTeam.CurrentPitcher;
            }
            else
            {
                winningPitcher = visitingTeam.CurrentPitcher;
                losingPitcher = homeTeam.CurrentPitcher;
            }
        }
Example #16
0
 public void OnGameOver(GameWinner winner)
 {
     sliderAnimator.Play("sliderin");
 }