示例#1
0
 public override void Reason(GameObject[] gameObjects)
 {
     if (!mIsRun)                                       //如果当前没有在移动
     {
         Fsm.PerformTransition(Transition.ReadytoWalk); //进入IdleState
     }
     if (MYXZInput.GetKeyDown(KeyCode.Space))
     {
         Fsm.PerformTransition(Transition.ReadytoJump); //进入JumpState
     }
 }
示例#2
0
        void Update()
        {
            Player.Update();
            if (MYXZInput.GetKeyDown(KeyCode.Escape))
            {
                EscSignal.Dispatch();
            }

            if ((this.Player.PlayerFsm.CurrentStateID == StateID.IdleState || this.Player.PlayerFsm.CurrentStateID == StateID.WalkState) &&
                MYXZInput.GetMouseButtonDown(0))
            {
                TryToTalk();
            }
            //            WeatherSystem.SetDate(12, 12, 2018);
            //            WeatherSystem.ChangeWeatherInstant(12);
        }
示例#3
0
 public override void Reason(GameObject[] gameObjects)
 {
     if (MYXZInput.GetKey(KeyCode.A) || MYXZInput.GetKey(KeyCode.W) ||
         MYXZInput.GetKey(KeyCode.S) || MYXZInput.GetKey(KeyCode.D)) //如果玩家按下了移动键
     {
         this.Fsm.PerformTransition(Transition.ReadytoWalk);         //进入WalkState
     }
     if (mCharacter.IsTalking)                                       //如果玩家正在谈话
     {
         this.Fsm.PerformTransition(Transition.ReadytoChat);         //进入ChatState
     }
     if (MYXZInput.GetKeyDown(KeyCode.Space))
     {
         Fsm.PerformTransition(Transition.ReadytoJump); //进入JumpState
     }
 }
示例#4
0
 public override void Reason(GameObject[] gameObjects)
 {
     if (!mIsWalk)                                      //如果当前没有在移动
     {
         Fsm.PerformTransition(Transition.ReadytoIdle); //进入IdleState
     }
     if (mCharacter.IsTalking)                          //如果Player当前正在交谈
     {
         Fsm.PerformTransition(Transition.ReadytoChat); //进入ChatState
     }
     if (MYXZInput.GetKeyDown(KeyCode.Space))
     {
         Fsm.PerformTransition(Transition.ReadytoJump); //进入JumpState
     }
     if (MYXZInput.GetKey(KeyCode.LeftShift))
     {
         Fsm.PerformTransition(Transition.ReadytoRun);//进入RunState
     }
 }
示例#5
0
        public override void StateAction(GameObject[] gameObjects)
        {
            mIsRun     = false;
            mLR        = mFB = 0;
            mDirection = Vector3.zero;
            if (MYXZInput.GetKey(KeyCode.LeftShift))
            {
                if (MYXZInput.GetKey(KeyCode.W))
                {
                    mDirection += this.Fsm.Owner.transform.forward;
                    mIsRun      = true;
                    mFB--;
                }
                if (MYXZInput.GetKey(KeyCode.A))
                {
                    mDirection -= this.Fsm.Owner.transform.right;
                    mIsRun      = true;
                    mLR--;
                }
                if (MYXZInput.GetKey(KeyCode.S))
                {
                    mDirection -= this.Fsm.Owner.transform.forward;
                    mIsRun      = true;
                    mFB++;
                }
                if (MYXZInput.GetKey(KeyCode.D))
                {
                    mDirection += this.Fsm.Owner.transform.right;
                    mIsRun      = true;
                    mLR++;
                }
            }

            mCharacter.Animator.SetBool("run", true);
            this.mCharacter.Direction = this.mDirection * mCharacter.RunSpeed;

            mCharacter.Animator.SetInteger("LR", mLR);
            mCharacter.Animator.SetInteger("FB", mFB);
        }
示例#6
0
        public override void StateAction(GameObject[] gameObjects)
        {
            mIsWalk    = false;
            mLR        = mFB = 0;
            mDirection = Vector3.zero;
            if (MYXZInput.GetKey(KeyCode.W))
            {
                mDirection += this.Fsm.Owner.transform.forward;
                mIsWalk     = true;
                mFB--;
            }
            if (MYXZInput.GetKey(KeyCode.A))
            {
                mDirection -= this.Fsm.Owner.transform.right;
                mIsWalk     = true;
                mLR--;
            }
            if (MYXZInput.GetKey(KeyCode.S))
            {
                mDirection -= this.Fsm.Owner.transform.forward;
                mIsWalk     = true;
                mFB++;
            }
            if (MYXZInput.GetKey(KeyCode.D))
            {
                mDirection += this.Fsm.Owner.transform.right;
                mIsWalk     = true;
                mLR++;
            }
            mCharacter.Animator.SetBool("walk", true);
            mCharacter.Animator.SetBool("run", false);
            this.mCharacter.Direction = this.mDirection * mCharacter.WalkSpeed;
            //mPlayerController.Move(mDirection * mCharacter.WalkSpeed * Time.fixedDeltaTime); //行走移动

            mCharacter.Animator.SetInteger("LR", mLR);
            mCharacter.Animator.SetInteger("FB", mFB);
        }