public static void Interact(InteractiveUser user)
 {
     foreach (var interactive in GetCandidates(user))
     {
         if (interactive.Interact(user))
         {
             break;
         }
     }
 }
 public bool Interact(InteractiveUser user)
 {
     if (user.CanInteract(this) && CanInteract(user))
     {
         Callable.Call(OnInteract, user.gameObject);
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public static Interactive[] GetCandidates(InteractiveUser user)
        {
            List <Interactive> candidates = new List <Interactive>();

            foreach (var interactive in s_Interactives)
            {
                // Filter interactives at user's reach

                if (interactive.CanInteract(user))
                {
                    candidates.Add(interactive);
                }
            }

            return(user.SortCandidates(candidates.ToArray()));
        }
예제 #4
0
 public override bool CanInteract(InteractiveUser user)
 {
     return(Vector3.Distance(user.transform.position, this.transform.position) < Distance);
 }
 public abstract bool CanInteract(InteractiveUser user);