Esempio n. 1
0
    public IEnumerator handlePlayerSpawn(V2PlayerManager PM)
    {
        yield return(new WaitForSeconds(respawnTime));

        PM.RpcSpawn();
        PlayersAlive++;
    }
Esempio n. 2
0
    /// <summary>
    /// Handles player death notification from the death mesh and passes the message forward to clients via RPC, logs the death onto the leaderboard.
    /// </summary>
    /// <param name="playerManager">The playerManager of the dieing player</param>
    ///
    public void handlePlayerDeath(V2PlayerManager playerManager)
    {
        playerManager.RpcDie();

        // TODO: Handle leaderboard.
        StartCoroutine(handlePlayerSpawn(playerManager));

        // maybe havea coroutine for handle player LMS death, which only respawns once all are dead?
    }
Esempio n. 3
0
 public void handlePlayerDeath(V2PlayerManager playerManager)
 {
     playerManager.RpcDie();
     PlayersAlive--;
     if (PlayersAlive == 1)
     {
         for (int i = 0; i < Players.Length; i++)
         {
             if (Players[i].isDead == false)
             {
                 Debug.Log(Players[i].name);
             }
         }
         killAllAlive();
         spawnAll();
     }
 }
Esempio n. 4
0
 public void playerLeft(V2PlayerManager playerManager)
 {
     if (playerManager.isDead == false)
     {
         PlayersAlive--;
     }
     temp    = GameObject.FindGameObjectsWithTag("Player");
     Players = new V2PlayerManager[temp.Length];
     for (int i = 0; i < temp.Length; i++)
     {
         Players[i] = temp[i].GetComponent <V2PlayerManager>();
     }
     if (matchable == true)
     {
         if (Players.Length == 1)
         {
             matchable = false;
             killAllAlive();
         }
     }
 }
Esempio n. 5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            V2PlayerManager playerManager = other.gameObject.GetComponent <V2PlayerManager>();

            if (playerManager != null)
            {
                serverGameManager.currentGamemode.handlePlayerDeath(playerManager); // inform serverGameManager the player has died.
                //serverGameManager.SendMessage("handlePlayerDeath",playerManager);
            }
        }
        else if (other.gameObject.CompareTag("World Rigidbody"))
        {
            WorldRigidBody wrb = other.gameObject.GetComponent <WorldRigidBody>();

            if (wrb != null)
            {
                serverGameManager.handleWorldRigidBodyRespawn(wrb);
            }
        }
    }