Example #1
0
 public void SpeedDown(float coefficient)
 {
     if (mogoMotor.speed == preSpeed)
     {
         preSpeed = mogoMotor.speed;
         mogoMotor.SetSpeed(preSpeed * coefficient);
     }
 }
Example #2
0
        // 状态处理
        public void Process(EntityParent theOwner, params System.Object[] args)
        {
            MogoMotor theMotor = theOwner.motor;

            if (theOwner is EntityMonster || (theOwner is EntityPlayer && !(theOwner is EntityMyself)))
            {
                theOwner.ApplyRootMotion(false);
                theOwner.SetSpeed(1);
                theMotor.SetSpeed(0.4f);


                //服务器没有同步其他玩家的速度,这里暂时硬编码处理,
                //待确定其他玩家与怪物移动位移的控制方案再修改(程序控制还是动作位移)
                if (theOwner.speed == 0)
                {
                    //theMotor.SetExrtaSpeed(6);
                }
                else
                {
                    theMotor.SetExrtaSpeed(theOwner.speed);
                }
                return;
            }
            else if (theOwner is EntityDummy || theOwner is EntityMercenary)
            {
                theOwner.ApplyRootMotion(false);
                //theOwner.SetSpeed(1);
                theMotor.SetSpeed(0.4f * theOwner.aiRate);
                theMotor.SetExrtaSpeed(theOwner.GetIntAttr("speed") * 0.01f * theOwner.blackBoard.speedFactor * theOwner.aiRate);
            }
            else
            {
                theOwner.ApplyRootMotion(true);
                // theOwner.SetSpeed(1);
                theMotor.SetExrtaSpeed(5);
                theMotor.SetSpeed(0.4f);
            }
            theMotor.isMovable = true;
        }
Example #3
0
        // 状态处理
        public void Process(EntityParent theOwner, params Object[] args)
        {
            // 播放 idle 动画
            if (theOwner == null)
            {
                return;
            }
            if (theOwner.CanMove() && theOwner.motor != null)
            {
                theOwner.motor.enableStick = true;
            }
            MogoMotor theMotor = theOwner.motor;

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