Exemple #1
0
        public void RemovePlayer(Player player)
        {
            if (!Players.Contains(player))
            {
                return;
            }

            Players.Remove(player);
            PlayerDeaths.Remove(player);
            PlayerKills.Remove(player);
            player.HealthManager.PlayerKilled -= HealthManagerOnPlayerKilled;
        }
Exemple #2
0
        public void AddPlayer(Player player)
        {
            if (Players.Contains(player))
            {
                return;
            }

            Players.Add(player);
            PlayerDeaths.Add(player, 0);
            PlayerKills.Add(player, 0);
            player.HealthManager.PlayerKilled += HealthManagerOnPlayerKilled;
        }
    public void CheckPlayer()
    {
        //check what the value of playerturns is if the function is called, this will be called after checking for the death of the player.
        switch (playerTurns)
        {
        //once the turns have been changed after death, spawn the ball at the opposing side and set that it is player1s turn to die

        //if it is player1s turn spawn them at thier safe zone
        case PlayerTurns.Player1Active:
            //UiManager.Instance.UpdateTurn("It is" + playerTurns + "turn");
            UiManager.Instance.UpdateTurn("It is Player1's turn");

            //turn the goals on and off to stop registering collision when it spawns
            player1Goalobj.SetActive(false);
            player2Goalobj.SetActive(true);

            //make sure on there turn, tell the manager it also thier turn to die, then spawn them at thier starting possition
            Debug.Log("It is player 1's turn");
            playerDeaths = PlayerDeaths.Player1Death;
            //it is this players turn to score
            playerToScore = PlayerScored.Player1Scored;
            //change the players color to indicate clearer whos turn it is
            CheckColor(player1Color);
            // colorOfPlayer = player1Color;
            Ball.transform.position = spawnpoint.position;
            break;

        //if it is player1s turn spawn them at thier safe zone
        case PlayerTurns.Player2Active:
            //UiManager.Instance.UpdateTurn("It is" + playerTurns + "turn");
            UiManager.Instance.UpdateTurn("It is Player2's turn");

            //turn the goals on and off to stop registering collision when it spawns
            player1Goalobj.SetActive(true);
            player2Goalobj.SetActive(false);

            Debug.Log("It is player 2's turn");
            playerDeaths = PlayerDeaths.Player2Death;
            //it is this players turn to score
            playerToScore = PlayerScored.Player2Scored;
            //change the players color to indicate clearer whos turn it is
            CheckColor(player2Color);
            // colorOfPlayer = player2Color;
            Ball.transform.position = spawnpoint2.position;
            break;
        }
    }
 //POO
 //BOA PRATICA CHAMAR NO START E AWAKE UMA VEZ SÓ
 void Awake()
 {
     anotherScript    = GetComponent <PlayerScore>();
     yetAnotherScript = otherGameObject.GetComponent <PlayerDeaths>();
     //BoxCollider = GetComponent<BoxCollider>();
 }