示例#1
0
 private void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.CompareTag("Bounds"))
     {
         OnOutOfBounds?.Invoke(this);
         Destroy(gameObject);
     }
 }
示例#2
0
        private void FixedUpdate()
        {
            if (autoMove == true && canMove == true)
            {
                movable.MoveRight();
            }

            if (gameObject.transform.position.x >= xBound)
            {
                OnOutOfBounds?.Invoke();
            }
        }
示例#3
0
 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);
     }
 }
示例#4
0
 public void OutOfBounds()
 {
     OnOutOfBounds?.Invoke();
 }