Exemplo n.º 1
0
        /// <summary>
        /// Performs the fixed update loop for the State. Also checks transitions if FIXED_CHECK_TRANSITIONS is defined
        /// </summary>
        /// <param name="obj">A reference to the object</param>
        public void DoFixedUpdate(ref T obj)
        {   //Null catch/default catch. This is kind of redundant for structs but its necessary to avoid having to default/null catch in every state
            if (EqualityComparer <T> .Default.Equals(obj, default))
            {
                return;
            }
            //Null catch again
            if (_current != null)
            {   //Defines woo
#if FIXED_CHECK_TRANSITIONS
                //Do we need to make a global transition                    //Do we need to make a transition out of the current state
                if (CheckTransitions(ref ctrl, ref globalTransitions, null) || CheckTransitions(ref ctrl, ref current.transitions, current.ignoreTransition))
                {
                    //Swap the states
                    SwapStates(ref ctrl);
                }
#endif
                //Call the fixed update
                _current.State_Fixed(ref obj);
            }
        }