/// <summary> /// @author Riyad K Rahman <br></br> /// handles respawning and its animation /// </summary> private void FixedUpdate() { //for respawning if (respawning == true) { if (transform.position.y <= 0.5) { gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionY; photonView.RPC("deactivateBalloon", RpcTarget.AllBuffered); shootClass.SetShoot(true); gameObject.GetComponent <PlayerMovement>().SetIsInputEnabled(true); respawning = false; } else { // freeze co-ords (X and Z axis), then slowly descend down gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ; transform.Translate(descend * Time.deltaTime, Space.World); } } }