Quantcast
Viewing latest article 16
Browse Latest Browse All 205

Open Door on all enemies dead?

I want to trigger an animation to open the door when I kill all enemies in a given arena, and I briefly had it, but then it stopped working, not sure why. Here is the script I have so far: public class Door : MonoBehaviour { public Vector3 halfDimensions; public Vector3 boxCenter; public LayerMask layerMask; public Animator anim; private void OnDrawGizmos() { Gizmos.DrawWireCube(boxCenter, halfDimensions); } // Update is called once per frame void Update() { Collider[] enemiesRemaining = Physics.OverlapBox(boxCenter, halfDimensions, Quaternion.identity, layerMask); if (enemiesRemaining.Length == 0f) { Debug.Log("Arena Cleared."); anim.SetTrigger("Opening"); anim.SetBool("Open", true); } //if (!Physics.CheckBox(boxCenter, halfDimensions, Quaternion.identity, layerMask)) //{ // Debug.Log("Arena Cleared."); // anim.SetTrigger("Opening"); // anim.SetBool("Open", true); //} } } the part I commented was something I tried before but didn't work. What am I doing wrong?

Viewing latest article 16
Browse Latest Browse All 205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>