private void OnTriggerEnter2D(Collider2D collision) { SpikeTrapAS sp = collision.GetComponent <SpikeTrapAS>(); if (sp != null) { particle.GetComponent <ParticleSystem>().Emit(1); instance.damagePlayer(); /* AudioManager.instance.Play("GameOverMusic"); * SceneManager.LoadScene("Death"); * AudioManager.instance.SwitchMusic("Theme1", "MenuBGM");*/ return; } EnemyAI enemy = collision.GetComponent <EnemyAI>(); if (enemy != null) { AudioManager.instance.Play("GameOverMusic"); SceneManager.LoadScene("Death"); AudioManager.instance.SwitchMusic("Theme1", "MenuBGM"); } }
private void OnTriggerEnter2D(Collider2D collision) { CharacterMovement sp = collision.GetComponent <CharacterMovement>(); if (sp != null) { //If player collides withh button activate spikes SpikeTrapAS.Ativated(); } }