diff --git a/Assets/GameObjects/Prefabs/Player.prefab b/Assets/GameObjects/Prefabs/Player.prefab index e523325..08b794d 100644 --- a/Assets/GameObjects/Prefabs/Player.prefab +++ b/Assets/GameObjects/Prefabs/Player.prefab @@ -843,6 +843,9 @@ MonoBehaviour: Body: {fileID: 7391558913662534769} Gun: {fileID: 1865991757674780053} GunBobber: {fileID: 2075495528035690810} + DisabledOnDeath: + - {fileID: 7391558912582364398} + - {fileID: 7391558913556166741} CameraRoot: {fileID: 4833458671639168932} BulletSourcePoint: {fileID: 2637233632139837434} BulletHitLayer: @@ -870,6 +873,7 @@ MonoBehaviour: GravitationalVelocity: {x: 0, y: 0, z: 0} GroundedTime: 0 NetId: 0 + IsDead: 0 LatestGroundedY: 0 GroundCastLength: 0.2 GroundLayer: diff --git a/Assets/Scripts/Players/Player.cs b/Assets/Scripts/Players/Player.cs index 64ad65d..ae5936a 100644 --- a/Assets/Scripts/Players/Player.cs +++ b/Assets/Scripts/Players/Player.cs @@ -25,6 +25,9 @@ namespace NeonTea.Quakeball.Players { public Transform Gun; public Animator GunBobber; + [Tooltip("GameObjects that are disabled on death and re-enabled on respawn.")] + public GameObject[] DisabledOnDeath; + [Header("Shooting")] [Tooltip("For raycasting the shoot target.")] public Transform CameraRoot; @@ -230,6 +233,9 @@ namespace NeonTea.Quakeball.Players { } TimeofDeath = Time.time; MoveDirection = Vector3.zero; + foreach (GameObject obj in DisabledOnDeath) { + obj.SetActive(false); + } IsDead = true; } @@ -240,6 +246,9 @@ namespace NeonTea.Quakeball.Players { Net.Singleton.Instance.LocalPlayer.Controlled.GetComponent().DisableInput -= 1; } transform.position = location; + foreach (GameObject obj in DisabledOnDeath) { + obj.SetActive(true); + } IsDead = false; }