Esempio n. 1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);



            if (CombatSprite.GetcurrentAnimation() != null && CombatSprite.GetcurrentAnimation().IsLoop == false)
            {
                if (CombatSprite.IsPlaybackComplete == false)
                {
                    return;
                }

                State = RolePlayingGameData.Character.CharacterState.Idle;
            }


            switch (State)
            {
            case RolePlayingGameData.Character.CharacterState.Walking:
            case RolePlayingGameData.Character.CharacterState.Idle:


                WindowsGame2.AI.InputData input = GetInputData();

                _CurAIState = MyLearning.I.GetNextAction(input);

                break;
            }


            switch (_CurAIState)
            {
            case OUTPUT.STAND:
                State = RolePlayingGameData.Character.CharacterState.Idle;

                break;

            case OUTPUT.ATTACK:
                State = RolePlayingGameData.Character.CharacterState.Attack;
                break;

            case OUTPUT.FAR:
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Update the player for this frame.
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (CombatSprite.GetcurrentAnimation() != null && CombatSprite.GetcurrentAnimation().IsLoop == false)
            {
                if (CombatSprite.IsPlaybackComplete == false)
                {
                    return;
                }
            }

            Vector2 movePos = new Vector2(0, 0);

            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Left))
            {
                _LastDir = -1;

                movePos += new Vector2(-1, 0);
            }
            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Right))
            {
                _LastDir = 1;
                movePos += new Vector2(1, 0);
            }
            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up))
            {
                movePos += new Vector2(0, -1);
            }
            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down))
            {
                movePos += new Vector2(0, 1);
            }


            if (movePos.Length() != 0)
            {
                State = RolePlayingGameData.Character.CharacterState.Walking;



                Position += movePos;
            }
            else
            {
                //if( this.CombatSprite.currentAnimation == null
                //    || this.CombatSprite.currentAnimation.IsLoop == false)

                State = RolePlayingGameData.Character.CharacterState.Idle;
            }



            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Space))
            {
                State = RolePlayingGameData.Character.CharacterState.Hit;

                //_Player.CombatSprite.PlayAnimation("Hit");
            }


            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.LeftControl))
            {
                State = RolePlayingGameData.Character.CharacterState.Attack;
                //_Player.CombatSprite.PlayAnimation("Hit");
            }
        }