Esempio n. 1
0
        private void OnCollisionEntered(object sender, CollisionEventArgs args)
        {
            if (this.Player == null)
            {
                return;
            }

            if (args.First != this.Player.PlayerInteractionCollider)
            {
                return;
            }

            var interactable = args.Second.GetComponentInParent<InteractableComponent>();

            if (interactable == null)
            {
                return;
            }

            this.interactablesInRange.Add(interactable);

            // Notify listeners.
            this.EventManager.OnInteractableEnteredRange(
                this,
                new InteractableEnteredRangeEventArgs { GameObject = interactable.gameObject });

            // Update selection.
            this.SelectInteractable();
        }
Esempio n. 2
0
        private void OnCollisionEntered(object sender, CollisionEventArgs args)
        {
            if (this.Player == null)
            {
                return;
            }

            if (!this.mayLeave)
            {
                return;
            }

            if (args.First != this.Player.PlayerInteractionCollider)
            {
                return;
            }

            var exit = args.Second.GetComponentInParent<ExitComponent>();

            if (exit == null)
            {
                return;
            }

            // Victory!
            this.EventManager.OnVictory(this, EventArgs.Empty);
        }
Esempio n. 3
0
 public void OnCollisionExited(object sender, CollisionEventArgs args)
 {
     var handler = this.CollisionExited;
     if (handler != null)
     {
         handler(sender, args);
     }
 }