private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Enemy") { Infoscript.instance.DamageHealthpoints(1); cameraShake.Shake(0.4f, 0.1f); Soundcontrollerscript.soundInstance.playAudioSource(1); } if (collision.tag == "BoostFlower") { PlayerMovement pM = GameObject.FindObjectOfType <PlayerMovement>(); pM.getBoost(); } if (collision.tag == "TriggerEvent") { Destroy(collision.gameObject); GameObject levelchanger = GameObject.Find("LevelChanger"); levelchanger.GetComponent <MainMenu>().FadeToLevel(); } if (collision.tag == "DeactivateObject") { this.gameObject.SetActive(false); } if (collision.tag == "DialogueTrigger") { DialogueTrigger dTrigger = collision.GetComponent <DialogueTrigger>(); dialogueBoxM.SetActive(true); dTrigger.TriggerDialogue(); dTrigger.ActivateButton(); dTrigger.DeactivateDialogue(); } if (collision.tag == "Checkpoint") { lastCheckpoint = collision.gameObject; } if (collision.tag == "Killzone") { cameraShake.Shake(0.4f, 0.1f); Respawn(); } if (collision.tag == "EndGame") { GameObject levelchanger = GameObject.Find("LevelChanger"); levelchanger.GetComponent <MainMenu>().FadeToLevel(); } if (collision.tag == "HealthItem") { if (HealthPoints < 3) { addHP(); Destroy(collision.gameObject); } } if (collision.tag == "Collectable") { currCollectables += 1; ProgressCollectables.updateCollactablesAmount(); collectablesAmount.text = currCollectables + " / 25"; Destroy(collision.gameObject); } if (collision.tag == "Amulette") { maxDash += 1; currDash += 1; //updateProgressMaxDash(); Infoscript.instance.UpdateDashAmulette(); Destroy(collision.gameObject); } if (collision.tag == "BossSoul") { Boss.bossInstance.changeBossHP(); Destroy(collision.gameObject); } if (collision.tag == "Projectile") { cameraShake.Shake(0.4f, 0.1f); Infoscript.instance.DamageHealthpoints(1); Soundcontrollerscript.soundInstance.playAudioSource(1); Destroy(collision.gameObject); } }