Exemple #1
0
        /// <summary>
        /// Checks if the state is currently active.
        /// </summary>
        public override bool GetIsActive(MobileComponent mobileComponent)
        {
            if (!mobileComponent || !mobileComponent.movementComponent)
            {
                return(false);
            }

            return(!mobileComponent.movementComponent.IsMoving);
        }
 void LoadComponents()
 {
     if (!agent)
     {
         agent = GetComponent <NavMeshAgent>();
     }
     if (!animator)
     {
         animator = GetComponent <Animator>();
     }
     if (!entityComponent)
     {
         entityComponent = GetComponent <MobileComponent>();
     }
 }
        /// <summary>
        /// Returns if the state is currently active.
        /// </summary>
        public override bool GetIsActive(MobileComponent mobileComponent)
        {
            // -- special case:
            // only players have a "walk state" while monsters and NPCs only feature
            // a "move state".

            if (!mobileComponent || !mobileComponent.movementComponent)
            {
                return(false);
            }

            if (mobileComponent is PlayerAccount)
            {
                return(((PlayerAccount)mobileComponent).playerMovementComponent.Running);
            }
            else
            {
                return(mobileComponent.movementComponent.IsMoving);
            }
        }
Exemple #4
0
 /// <summary>
 /// Abstract bool GetIsActive. Used to check if the Animation State is currently active.
 /// </summary>
 public abstract bool GetIsActive(MobileComponent mobileComponent);