private void OnCollisionEnter2D(Collision2D collision) { jumpCount = 0; PlayerInteractable pi = collision.gameObject.GetComponent <PlayerInteractable>(); if (pi) { pi.OnHit(collision, this); } }
void OnControllerColliderHit(ControllerColliderHit hit) { if (this.currentState != State.Won) { //hit.gameObject.GetComponent<PlayerInteractable>()?.OnHit(hit, this); PlayerInteractable pi = hit.gameObject.GetComponent <PlayerInteractable>(); if (pi) { pi.OnHit(hit, this); } } }
void OnControllerColliderHit(ControllerColliderHit hit) { if (this.currentState != State.Won) { //hit.gameObject.GetComponent<PlayerInteractable>()?.OnHit(hit, this); PlayerInteractable pi = hit.gameObject.GetComponent <PlayerInteractable>(); if (pi) { if (pi.GetType() == typeof(Killing)) { gameManager.CountDeath(); gameManager.RespawnPlayer(); } pi.OnHit(hit, this); } } }
void OnControllerColliderHit(ControllerColliderHit hit) { if (this.currentState != State.Won) { PlayerInteractable pi = hit.gameObject.GetComponent <PlayerInteractable>(); if (pi) { pi.OnHit(hit, this); ///////////////////////////////////////////////////////// if (pi.GetComponent <Killing>()) { Toolbox.GetInstance().GetManager <GameManager>().AddSceneTime(); Toolbox.GetInstance().GetManager <GameManager>().AddDiedCount(); Toolbox.GetInstance().GetManager <GameManager>().Respawn(); } ///////////////////////////////////////////////////////// } } }