コード例 #1
0
 public void OnPlayerUpdate(Player player)
 {
     // is player in area?
     if (IsInside(player.Position))
     {
         // if not on list, add them and update listeners
         if (!PlayersInArea.Contains(player))
         {
             PlayersInArea.Add(player);
             PlayerEnteredArea.Invoke(player, new AreaEventArgs {
                 AreaBeingWatched = this
             });
         }
     }
     else
     {
         // if on list, remove them and update listeners
         if (PlayersInArea.Contains(player))
         {
             PlayersInArea.Remove(player);
             PlayerLeftArea.Invoke(player, new AreaEventArgs {
                 AreaBeingWatched = this
             });
         }
     }
 }
コード例 #2
0
 public virtual void OnTriggerExit(Collider other)
 {
     if (other.gameObject == player)
     {
         PlayerLeftArea?.Invoke();
         //PlayerInRange = false;
         //PlayerIsInteracting = false;
         //PlayerHeldInteractKeyUponEntering = false;
     }
 }