From f0aff9e5fdb7f801c9f9e40252cd1887816093ed Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 6 Feb 2023 15:59:19 -0500 Subject: [PATCH] cones no longer trigger stuff falsely --- unity/Assets/Scripts/DragonMovement.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index 70a9ad8..f0c4f06 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -65,11 +65,13 @@ public class DragonMovement : MonoBehaviour private void OnTriggerEnter2D(Collider2D collision) { + /* GameObject cone = transform.Find(CONE_NAME)?.gameObject; if (cone) { GameObject.Destroy(cone); } + */ CheckCloudCollision(collision); @@ -102,6 +104,8 @@ public class DragonMovement : MonoBehaviour if (collision.CompareTag("Fireball")) { Fireball fireball = collision.GetComponent(); + if (fireball.transform.parent.gameObject == this.gameObject) + return; if (fireball.AttackType == AttackType.CONE) { @@ -155,6 +159,9 @@ public class DragonMovement : MonoBehaviour _animator = this.GetComponent(); _trail.startColor = _color; _trail.endColor = _color; + + Ammo = 5; + _attackType = AttackType.CONE; } private void Update() @@ -204,6 +211,8 @@ public class DragonMovement : MonoBehaviour fireball.name = CONE_NAME; fireball.GetComponent().AttackType = AttackType.CONE; fireball.transform.parent = this.transform; + Rigidbody2D rigidBody = fireball.AddComponent(); + rigidBody.isKinematic = true; } }