Commit 6af717c6 by Philipp Adolf

Fix fire not being deleted on restart

parent 0fac9a27
...@@ -13,6 +13,7 @@ public class FireScript : MonoBehaviour ...@@ -13,6 +13,7 @@ public class FireScript : MonoBehaviour
private Vector3 startScale; //fixes a bug: scale of fire was 0 when attached to the player. private Vector3 startScale; //fixes a bug: scale of fire was 0 when attached to the player.
private Vector2 spawnPosition; private Vector2 spawnPosition;
private Transform spawnParent;
public float respawnTime = 5.0f; public float respawnTime = 5.0f;
public float relayDelay = 0.25f; public float relayDelay = 0.25f;
...@@ -23,6 +24,7 @@ public class FireScript : MonoBehaviour ...@@ -23,6 +24,7 @@ public class FireScript : MonoBehaviour
{ {
startScale = transform.localScale; startScale = transform.localScale;
spawnPosition = transform.position; spawnPosition = transform.position;
spawnParent = transform.parent;
pickupAudio = GetComponent<AudioSource>(); pickupAudio = GetComponent<AudioSource>();
} }
...@@ -59,7 +61,7 @@ public class FireScript : MonoBehaviour ...@@ -59,7 +61,7 @@ public class FireScript : MonoBehaviour
{ {
CancelInvoke("stopBurning"); CancelInvoke("stopBurning");
parentHealth = null; parentHealth = null;
transform.parent = null; transform.parent = spawnParent;
transform.position = new Vector2(100, 100); transform.position = new Vector2(100, 100);
Invoke("Activate", respawnTime); Invoke("Activate", respawnTime);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment