private void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("Bounds")) { OnOutOfBounds?.Invoke(this); Destroy(gameObject); } }
private void FixedUpdate() { if (autoMove == true && canMove == true) { movable.MoveRight(); } if (gameObject.transform.position.x >= xBound) { OnOutOfBounds?.Invoke(); } }
private void OnTriggerExit2D(Collider2D other) { if (other.tag == "Player" || other.tag == "Enemy") { if (OnOutOfBounds != null) OnOutOfBounds.Invoke(other.GetComponent<HealthComponent>()); } else if (other.transform.parent.parent == null) { if (OnOutOfBoundsItem != null) OnOutOfBoundsItem.Invoke(other.transform); } }
public void OutOfBounds() { OnOutOfBounds?.Invoke(); }