Make it so you can't shoot dead bodies

This commit is contained in:
Sofia 2020-08-08 16:40:26 +03:00
parent 41ac280e02
commit 7f7762e606
2 changed files with 13 additions and 0 deletions

View File

@ -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:

View File

@ -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<LocalPlayer>().DisableInput -= 1;
}
transform.position = location;
foreach (GameObject obj in DisabledOnDeath) {
obj.SetActive(true);
}
IsDead = false;
}