pt2
This commit is contained in:
@@ -138,7 +138,6 @@ public class GameManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void RespawnPlayer(GameObject player) // Respawns player at the spawn point and resets health
|
private void RespawnPlayer(GameObject player) // Respawns player at the spawn point and resets health
|
||||||
{
|
{
|
||||||
RespawnOnTriggerEnter respawnScript = player.GetComponent<RespawnOnTriggerEnter>();
|
RespawnOnTriggerEnter respawnScript = player.GetComponent<RespawnOnTriggerEnter>();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ public class HatRespawn : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (isDropped && Time.time - lastInteractionTime > respawnTime)
|
if (isDropped && Time.time - lastInteractionTime > respawnTime)
|
||||||
{
|
{
|
||||||
Debug.Log("Hat has been inactive for too long. Respawning...");
|
|
||||||
RespawnHat();
|
RespawnHat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,7 +24,6 @@ public class HatRespawn : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (collision.gameObject.CompareTag("Platformer Hazard"))
|
if (collision.gameObject.CompareTag("Platformer Hazard"))
|
||||||
{
|
{
|
||||||
Debug.Log("Hat collided with Platformer Hazard. Respawning...");
|
|
||||||
RespawnHat();
|
RespawnHat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,14 +32,12 @@ public class HatRespawn : MonoBehaviour
|
|||||||
{
|
{
|
||||||
lastInteractionTime = Time.time;
|
lastInteractionTime = Time.time;
|
||||||
isDropped = false;
|
isDropped = false;
|
||||||
Debug.Log("Hat interacted with. Resetting timer.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnHatDropped() // Resets the timer when the hat is dropped
|
public void OnHatDropped() // Resets the timer when the hat is dropped
|
||||||
{
|
{
|
||||||
lastInteractionTime = Time.time;
|
lastInteractionTime = Time.time;
|
||||||
isDropped = true;
|
isDropped = true;
|
||||||
Debug.Log("Hat dropped. Starting respawn timer.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RespawnHat() // Respawns the hat at the designated spawn position
|
private void RespawnHat() // Respawns the hat at the designated spawn position
|
||||||
@@ -51,6 +47,5 @@ public class HatRespawn : MonoBehaviour
|
|||||||
transform.rotation = Quaternion.identity;
|
transform.rotation = Quaternion.identity;
|
||||||
lastInteractionTime = Time.time; // Reset the timer after respawning
|
lastInteractionTime = Time.time; // Reset the timer after respawning
|
||||||
isDropped = false;
|
isDropped = false;
|
||||||
Debug.Log("Hat respawned at designated position.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user