// 离开状态 public void Exit(EntityParent theOwner, params Object[] args) { if (theOwner is EntityDummy) { theOwner.ApplyRootMotion(false); } }
// 进入该状态 public void Enter(EntityParent theOwner, params Object[] args) { theOwner.CurrentMotionState = MotionState.HIT; if (theOwner is EntityDummy) { theOwner.ApplyRootMotion(true); } }
// 离开状态 public void Exit(EntityParent theOwner, params System.Object[] args) { theOwner.ApplyRootMotion(true); theOwner.SetSpeed(1); if (theOwner is EntityMonster) { theOwner.motor.SetExrtaSpeed(0); theOwner.motor.isMovingToTarget = false; return; } if (theOwner is EntityDummy) { theOwner.ApplyRootMotion(false); } if (theOwner is EntityMyself) { theOwner.animator.speed = 1; } }
// 状态处理 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; }
// 状态处理 public void Process(EntityParent theOwner, params Object[] args) { int action = ActionConstants.DIE; theOwner.ApplyRootMotion(true); string actName = theOwner.CurrActStateName(); if (actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT_AIR]) || actName.EndsWith("getup")) { action = ActionConstants.DIE_KNOCK_DOWN; theOwner.SetAction(action); } else if (actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT_GROUND]) || actName.EndsWith("knockout")) { action = ActionConstants.DIE; theOwner.SetAction(action); } else { int hitActionID = (int)(args[0]); List <int> deadAction = null; if (SkillAction.dataMap.ContainsKey(hitActionID)) { deadAction = SkillAction.dataMap[hitActionID].deadAction; } action = ActionConstants.DIE; if (deadAction == null || deadAction.Count == 0) { action = ActionConstants.DIE; } else { action = Utils.Choice <int>(deadAction); } theOwner.SetAction(action); } theOwner.SetSpeed(0); EventDispatcher.TriggerEvent(Events.LogicSoundEvent.OnHitYelling, theOwner as EntityParent, action); if (theOwner is EntityMyself && theOwner.motor) { theOwner.motor.enableStick = false; } //theOwner.AddCallbackInFrames<int>(theOwner.SetAction, 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(); }