コード例 #1
0
        public void Process(EntityParent theOwner, params object[] args)
        {
            GameMotor theMotor = theOwner.motor;

            if (theOwner is EntityBeast || (theOwner is EntityPlayer && !(theOwner is EntityMyself)))
            {
                theOwner.ApplyRootMotion(false);
                theOwner.SetSpeed(1);
                theMotor.SetSpeed(0.4f);
                if (theOwner.Speed == 0)
                {
                    theMotor.SetExtraSpeed(6);
                }
                else
                {
                    theMotor.SetExtraSpeed(theOwner.Speed);
                }
                return;
            }
            else
            {
                theOwner.ApplyRootMotion(true);
                theMotor.SetSpeed(0.4f);
                theMotor.SetExtraSpeed(0.4f);
            }
            theMotor.isMovable = true;
        }
コード例 #2
0
        public void Process(EntityParent theOwner, params object[] args)
        {
            int act = (int)ActionConstants.die;

            theOwner.ApplyRootMotion(true);
            string actName = theOwner.CurrActStateName();//当前动画的名称

            if (actName.EndsWith(PlayerActionName.actionOfNames[(int)ActionConstants.hit_air]) || actName.EndsWith("getup"))
            {
                act = (int)ActionConstants.die_knock_down;
                theOwner.SetAction(act);
            }
            else if (actName.EndsWith(PlayerActionName.actionOfNames[(int)ActionConstants.hited_ground]) || actName.EndsWith("knockout"))
            {
                act = (int)ActionConstants.die;
                theOwner.SetAction(act);
            }
            else
            {
            }
            theOwner.SetSpeed(0);
            EventDispatch.TriggerEvent(Event.LogicSoundEvent.OnHitYelling, theOwner as EntityParent, act);
            if (theOwner is EntityMyself && theOwner.motor)
            {
                theOwner.motor.enableStick = false;
            }
        }
コード例 #3
0
 public void Exit(EntityParent theOwner, params object[] args)
 {
     theOwner.ApplyRootMotion(true);
     theOwner.SetSpeed(1);
     if (theOwner is EntityBeast)
     {
         theOwner.motor.SetExtraSpeed(0);
         theOwner.motor.isMovingToTarget = false;
         return;
     }
     if (theOwner is EntityMyself)
     {
         theOwner.animator.speed = 1;
     }
 }
コード例 #4
0
        // 状态处理
        public void Process(EntityParent theOwner, params object[] args)
        {
            Debug.Log("Idle");
            // 播放 idle 动画
            if (theOwner == null)
            {
                return;
            }
            if (theOwner.CanMove() && theOwner.motor != null)
            {
                theOwner.motor.enableStick = true;
            }
            GameMotor theMotor = theOwner.motor;

            if (theOwner is EntityBeast)
            {
                theOwner.ApplyRootMotion(false);
            }
            // 设置速度
            if (theMotor != null)
            {
                theMotor.SetSpeed(0.0f);
                theMotor.SetExtraSpeed(0f);
            }
            if (theOwner.charging)
            {
                return;
            }
            if (theOwner is EntityPlayer && GameWorld.isInTown)
            {
                theOwner.SetAction(-1);
            }
            else
            {
                theOwner.SetAction(0);
            }
            theOwner.SetActionByStateFlagInIdleState();
        }