Exemplo n.º 1
0
    private void RpcRespawn()
    {
        // if (isLocalPlayer)
        //{

        // Disable physic effects so plane will respawn correctly
        GetComponent <Rigidbody>().isKinematic = true;

        // Set the player’s position to the chosen spawn point and reset rotation
        if (player1)
        {
            transform.rotation = spawnPoint1.transform.rotation;
            transform.position = spawnPoint1.transform.position;
        }
        else
        {
            transform.rotation = spawnPoint2.transform.rotation;
            transform.position = spawnPoint2.transform.position;
        }

        //Reset explosion to false again
        //ExplosionParticles.gameObject.SetActive(false);

        //Reset movement
        planeController.movementSpeed = 0;
        planeController.enginePower   = 0;
        planeController.SetDirections();

        //Enable physics and weapons
        GetComponent <Rigidbody>().isKinematic = false;
        weaponManager.enabled    = true;
        weaponManager.bullets    = weaponManager.maxBullets;
        weaponManager.bombAmount = weaponManager.maxBombs;
        weaponManager.reloading  = false;

        //Reset health and fuel when respawning
        currentHealth = startingHealth;
        GetComponent <FuelBar>().Respawn();
        //}
    }