예제 #1
0
        /// <summary>
        /// Updates the move of the character
        /// </summary>
        /// <param name="direction">The direction that the character is facing</param>
        /// <param name="characterLocation">The location of the character in the world</param>
        /// <param name="onCharacter">if this move should be on the character</param>
        /// <returns>If the move is done or inturruptable</returns>
        /// <remarks>Drawing for moves is taken care of in the Moves class</remarks>
        public bool UpdateMove(float direction, Vector2 characterLocation, bool onCharacter)
        {
            int CurrentIndex = Animation.GetCurrentIndex();

            HitboxBodies[CurrentIndex].Enabled  = true;
            HitboxBodies[CurrentIndex].Position = characterLocation;

            List <Body> AffectedBodies = FindTouchingBodies();

            HitboxBodies[CurrentIndex].Enabled = false;

            if (onCharacter)
            {
                AffectedBodies = new List <Body>()
                {
                    Animation.Bodies[CurrentIndex]
                }
            }
            ;

            //Animation.UpdateAnimation(characterLocation);
            Function(CurrentIndex, direction, AffectedBodies);

            return((DateTime.Now - Started).Milliseconds > Animation.PlayTime || Animation.AnimationAtEnd() ||
                   onCharacter);
        }