Update hat movement
This commit is contained in:
@@ -6,10 +6,13 @@ public class HatRespawn : MonoBehaviour
|
||||
private const float respawnTime = 10f;
|
||||
private bool isDropped;
|
||||
|
||||
public static bool canBePickedUp = true; // Flag to check if the hat can be picked up
|
||||
|
||||
void Start()
|
||||
{
|
||||
lastInteractionTime = Time.time;
|
||||
isDropped = false;
|
||||
transform.position = GameManager.Instance.hatSpawnPositions[Random.Range(0, GameManager.Instance.hatSpawnPositions.Count - 1)];
|
||||
}
|
||||
|
||||
void Update() // Checks if the hat has been inactive for too long
|
||||
@@ -42,8 +45,9 @@ public class HatRespawn : MonoBehaviour
|
||||
|
||||
private void RespawnHat() // Respawns the hat at the designated spawn position
|
||||
{
|
||||
transform.position = GameManager.Instance.hatSpawnPosition;
|
||||
transform.position = GameManager.Instance.hatSpawnPositions[Random.Range(0, GameManager.Instance.hatSpawnPositions.Count - 1)];
|
||||
GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
||||
GetComponent<Rigidbody2D>().angularVelocity = 0f;
|
||||
transform.rotation = Quaternion.identity;
|
||||
lastInteractionTime = Time.time; // Reset the timer after respawning
|
||||
isDropped = false;
|
||||
|
||||
Reference in New Issue
Block a user