using UnityEngine; public class KillOnContact : MonoBehaviour { private GameManager gameManager; private AchievementSystem achSys; private void Start() { gameManager = ObjectManager.GetObject(4).GetComponent<GameManager>(); achSys = ObjectManager.GetObject(4).GetComponent<AchievementSystem>(); } private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { if (name == "Kill Barrier") { gameManager.OnPlayerDeath(1); achSys.SetDeathByObstacle(false); achSys.IncrementDeathWallDeaths(); } else if (!other.gameObject.GetComponent<PlayerInvulnAbility>().GetInvulnActiveState()) { gameManager.OnPlayerDeath(0); achSys.SetDeathByObstacle(true); achSys.IncrementTimesDiedToObstacles(); } } } }