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

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