Beispiel #1
0
    public IEnumerator Respawn(int playerNumber)
    {
        if (playerNumber == 1)
        {
            yield return(new WaitForSeconds(respawnTime));

            grenades.p1Grenades = grenades.maxGrenades;
            ammo1.AmmoRefill();
            p1GameplayUI.SetActive(true);
            controller1.transform.position = spawnpoints[Random.Range(0, spawnpoints.Length)].transform.position;
            hp1 = 100;
            p1PlayerModel.SetActive(true);
            //p1Ragdoll.SetActive(true);
            p1WeaponHolder.SetActive(true);
            p1RB.isKinematic = false;
            p1RB.constraints = RigidbodyConstraints.None;
            p1RB.constraints = RigidbodyConstraints.FreezeRotation;
        }

        if (playerNumber == 2)
        {
            yield return(new WaitForSeconds(respawnTime));

            grenades.p2Grenades = grenades.maxGrenades;
            ammo2.AmmoRefill();
            p2GameplayUI.SetActive(true);
            controller2.transform.position = spawnpoints[Random.Range(0, spawnpoints.Length)].transform.position;
            hp2 = 100;
            p2PlayerModel.SetActive(true);
            //p1Ragdoll.SetActive(true);
            p2WeaponHolder.SetActive(true);
            p2RB.isKinematic = false;
            p2RB.constraints = RigidbodyConstraints.None;
            p2RB.constraints = RigidbodyConstraints.FreezeRotation;
        }
    }