public bool CanInteract(InteractionEvent interactionEvent)
        {
            if (RangeCheck && !InteractionExtensions.RangeCheck(interactionEvent))
            {
                return(false);
            }

            var provider = interactionEvent.Source as IGameObjectProvider;

            if (provider == null)
            {
                return(false);
            }

            SubstanceContainer container = provider.GameObject.GetComponent <SubstanceContainer>();

            if (container == null)
            {
                return(false);
            }

            // You cannot dispense to a container that is already full.
            if (container.RemainingVolume < 0.01f)
            {
                return(false);
            }

            return(CanInteractCallback.Invoke(interactionEvent));
        }
예제 #2
0
 public bool CanInteract(InteractionEvent interactionEvent)
 {
     if (RangeCheck && !InteractionExtensions.RangeCheck(interactionEvent))
     {
         return(false);
     }
     return(CanInteractCallback.Invoke(interactionEvent));
 }
        public bool CanInteract(InteractionEvent interactionEvent)
        {
            if (RangeCheck && !InteractionExtensions.RangeCheck(interactionEvent))
            {
                return(false);
            }

            var provider = interactionEvent.Source as IGameObjectProvider;

            if (provider == null)
            {
                return(false);
            }
            if (provider.GameObject.GetComponent <SubstanceContainer>() == null)
            {
                return(false);
            }
            return(CanInteractCallback.Invoke(interactionEvent));
        }
예제 #4
0
 public bool CanInteract(InteractionEvent interactionEvent)
 {
     return(CanInteractCallback.Invoke(interactionEvent));
 }