(probably) fixed bug where enemy doesn't reset if grappled
also moved the victory object lower in the brasslands
This commit is contained in:
		@@ -23,6 +23,7 @@ public class EnemyPatrol : MonoBehaviour {
 | 
			
		||||
    [Header("General")]
 | 
			
		||||
    public float moveSpeed;
 | 
			
		||||
    Animator animator;
 | 
			
		||||
    public bool isPlayingDefeatAnimation = false;
 | 
			
		||||
 | 
			
		||||
    void Awake() {
 | 
			
		||||
        animator = GetComponent<Animator>();
 | 
			
		||||
@@ -73,11 +74,13 @@ public class EnemyPatrol : MonoBehaviour {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    IEnumerator Defeat() {
 | 
			
		||||
        isPlayingDefeatAnimation = true;
 | 
			
		||||
        this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
 | 
			
		||||
        animator.Play("Explosion");
 | 
			
		||||
        this.gameObject.GetComponent<AudioSource>().Play();
 | 
			
		||||
        yield return new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length);
 | 
			
		||||
        this.gameObject.GetComponent<BoxCollider2D>().enabled = true;
 | 
			
		||||
        isPlayingDefeatAnimation = false;
 | 
			
		||||
        this.gameObject.SetActive(false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -203,6 +203,9 @@ public class StateController : MonoBehaviour
 | 
			
		||||
    {
 | 
			
		||||
        foreach (GameObject enemy in enemiesInScene)
 | 
			
		||||
        {
 | 
			
		||||
            if (enemy.GetComponent<EnemyPatrol>().isPlayingDefeatAnimation) {
 | 
			
		||||
                enemy.SetActive(false);
 | 
			
		||||
            }
 | 
			
		||||
            enemy.SetActive(true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user