Esempio n. 1
0
 /// <summary>
 /// Focus on transform and change interaction state
 /// </summary>
 /// <returns>
 /// Wether or not the function was successful
 /// </returns>
 public bool AttractMyAttention_ToTransform(Transform target, bool force, StatesInteraction interactionState = StatesInteraction.Interactor,
                                            ProximityHelpers.DistanceDirection distanceDirection             = ProximityHelpers.DistanceDirection.ALL)
 {
     if (IsWithinDistance(DistanceType.INTERACTION, target, distanceDirection) || force)
     {
         if (ChangeInteractionState(interactionState, force))
         {
             FocusOnTransform(target);
             //CurrentInteractionState = interactionState;
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
 /// <param name="force">Ignore the interaction cooldown if true</param>
 private bool ChangeInteractionState(StatesInteraction interactionState, bool force)
 {
     if (interactionState == StatesInteraction.NotInteracting)
     {
         CurrentInteractionState = interactionState;
         ResetInteractionCooldown();
         return(true);
     }
     else if (force || Time.time > CanInteractFromTime)
     {
         CurrentInteractionState = interactionState;
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
        /// <summary>
        /// Focus on Bot and change interaction state
        /// </summary>
        /// <returns>
        /// Wether or not the function was successful
        /// </returns>
        public bool AttractMyAttention_ToBot(Bot target, bool force, StatesInteraction interactionState = StatesInteraction.Interactor)
        {
            if (IsWithinDistance(DistanceType.INTERACTION, target.transform) || target.IsWithinDistance(DistanceType.INTERACTION, transform) || force)
            {
                if (target.CurrentInteractionState == StatesInteraction.Interactor)
                {
                    interactionState = StatesInteraction.Interactee;
                }

                if (ChangeInteractionState(interactionState, force))
                {
                    FocusOnTransform(target.transform);
                    //CurrentInteractionState = interactionState;
                    return(true);
                }
            }
            return(false);
        }