Commit ed2d0627 by Philipp Adolf

Fix fire oscilating between players

parent 113a58be
......@@ -15,6 +15,9 @@ public class FireScript : MonoBehaviour
private Vector2 spawnPosition;
public float respawnTime = 5.0f;
public float relayDelay = 0.25f;
private bool canRelay = true;
void Start()
{
startScale = transform.localScale;
......@@ -32,14 +35,21 @@ public class FireScript : MonoBehaviour
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
if (canRelay && other.tag == "Player")
{
Invoke("stopBurning", burningTime);
parentHealth = other.GetComponent<PlayerHealth>();
transform.position = other.transform.position; //hier schon position setzen
transform.parent = other.transform;
transform.localScale = startScale;
canRelay = false;
Invoke("enableRelay", relayDelay);
}
}
void enableRelay()
{
canRelay = true;
}
void stopBurning()
......
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