private void OnTriggerStay2D(Collider2D other) { LinkController controller = other.GetComponent <LinkController>(); if (controller != null) { controller.ChangeHealth(-1); } }
private void OnCollisionEnter2D(Collision2D other) { LinkController controller = other.gameObject.GetComponent <LinkController>(); if (controller != null) { controller.ChangeHealth(-1); } }
private void OnTriggerEnter2D(Collider2D other) { LinkController controller = other.GetComponent <LinkController>(); if (controller != null && collectible) { controller.maxHealth += 2; controller.ChangeHealth(2); Destroy(gameObject); } }
private void OnCollisionEnter2D(Collision2D other) { LinkController controller = other.gameObject.GetComponent <LinkController>(); if (controller != null) { controller.ChangeHealth(-1); grabbed = true; Vector2 position = rigidbody2d.position; controller.transform.position = startPosition; cam.GoBackToStart(); } }
private void OnCollisionEnter2D(Collision2D other) { LinkController controller = other.gameObject.GetComponent <LinkController>(); if (controller != null) { controller.ChangeHealth(-1); } else if (!returning) { direction = -1 * direction; speed = speed / 4; returning = true; } }
private void OnTriggerEnter2D(Collider2D other) { LinkController controller = other.GetComponent <LinkController>(); if (controller != null && collectible) { if (controller.life < controller.maxLife) { controller.ChangeHealth(amount); Destroy(gameObject); controller.PlaySound(collected); } } }
private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag(collisionTag)) { if (collisionTag == "Enemy") { EnemyReaction(other.gameObject); } else { LinkController controller = other.gameObject.GetComponent <LinkController>(); if (controller != null) { controller.ChangeHealth(-1); } } Destroy(gameObject); } else { timer = (2 * time) - timer - (float)0.1; } }