private void OnCollisionStay2D(Collision2D collision) { if ((((1 << collision.gameObject.layer) & passableObjectsLayerMask) != 0)) { return; } if (collision.transform.position.y > this.transform.position.y && GRD.GetGrounded()) { this.transform.localScale += new Vector3(Time.deltaTime, -Time.deltaTime) * squish_amount; this.transform.position -= Vector3.up * Time.deltaTime * squish_amount * 1 / 2; time += Time.deltaTime; } if (time >= death_time) { Health h = this.GetComponent <Health>(); if (h != null) { h.damage(1); } else { Debug.Log("no health"); } ee.invoke("player_damaged", (new[] { this.gameObject })); time = 0; } }
public override void interact(GameObject initiator) { if ((((1 << initiator.layer) & passableObjectsLayerMask) != 0)) { return; } if (!Gr.GetGrounded()) { Debug.Log("player bonked their head but is not grounded"); return; } Health h = this.transform.parent.GetComponent <Health>(); if (h != null) { h.damage(damage); } ee.invoke("player_damaged", (new[] { this.gameObject })); }