respawn in middle of safe zone

This commit is contained in:
Cat Flynn 2021-03-25 11:58:40 +00:00
parent 07cebb6ea5
commit 368cb90464
1 changed files with 3 additions and 2 deletions

View File

@ -16,6 +16,9 @@ public class SafeZone : MonoBehaviour
{ {
if (other.gameObject.CompareTag(PLAYER)) if (other.gameObject.CompareTag(PLAYER))
{ {
// set position to middle of safe zone
_respawnPosition.Value = transform.position;
// start counting safe time when we enter a safe zone // start counting safe time when we enter a safe zone
_safeTime.Value = 0; _safeTime.Value = 0;
} }
@ -26,8 +29,6 @@ public class SafeZone : MonoBehaviour
// Check if other game object is Player. // Check if other game object is Player.
if (other.gameObject.CompareTag(PLAYER)) if (other.gameObject.CompareTag(PLAYER))
{ {
_respawnPosition.Value = other.gameObject.transform.position;
// TODO: does this have implications for the time freeze ability? // TODO: does this have implications for the time freeze ability?
_safeTime.Value += Time.deltaTime; _safeTime.Value += Time.deltaTime;
} }