virtual public void OnHitAnimEnd(int nID) { if (theOwner.CurrentMotionState == MotionState.HIT) { theOwner.SetAction(0); } }
// 状态处理 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(0f); if (theOwner.charging) { return; } if (theOwner is EntityPlayer && MogoWorld.inCity) { theOwner.SetAction(-1); } else { theOwner.SetAction(0); } theOwner.SetActionByStateFlagInIdleState(); }
private void HitRule(EntityParent theOwner, int act, int hitActionID) { int action = act; HitState h = null; if (!HitState.dataMap.TryGetValue(theOwner.hitStateID, out h)) {//如果没有配置,用回原来接口 HitActionRule(theOwner, action, hitActionID); return; } string actName = theOwner.CurrActStateName(); if (theOwner.currSpellID != -1) { action = h.GetSkillAct(action); } else if (actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT])) { action = h.GetHitAct(action); } else if(actName.EndsWith(PlayerActionNames.names[ActionConstants.PUSH])) { action = h.GetPushAct(action); } else if(actName.EndsWith(PlayerActionNames.names[ActionConstants.KNOCK_DOWN])) { action = h.GetKnockDownAct(action); } else if(actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT_AIR])) { action = h.GetHitAirAct(action); } else if (actName.EndsWith("knockout")) { action = h.GetKnockOutAct(action); } else if (actName.EndsWith("getup")) { action = h.GetGetUpAct(action); } else if (theOwner.animator.GetInteger("Action") == ActionConstants.REVIVE) { action = h.GetReviveAct(action); } else //(theOwner.CurrentMotionState == MotionState.IDLE) { action = h.GetIdleAct(action); } if (action != 0) { theOwner.SetAction(action); } // 回调函数, 切换到 idle theOwner.AddCallbackInFrames<EntityParent, int>( (_theOwner, _hitAct) => { _theOwner.motor.CancleLookAtTarget(); _theOwner.TriggerUniqEvent<int>(Events.FSMMotionEvent.OnHitAnimEnd, _hitAct); if (_theOwner is EntityMyself) { _theOwner.SetSpeed(0); _theOwner.motor.SetSpeed(0); } }, theOwner, hitActionID ); }
private void HitActionRule(EntityParent theOwner, int act, int hitActionID) { int action = act; string actName = theOwner.CurrActStateName(); if (actName.EndsWith(PlayerActionNames.names[ActionConstants.KNOCK_DOWN])) {//击飞状态,受非浮空打击,一直倒地 action = ActionConstants.KNOCK_DOWN; return; } if (actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT_AIR])) {//浮空受击 action = ActionConstants.HIT_AIR; } else if (actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT_GROUND]) || actName.EndsWith("knockout")) { action = ActionConstants.HIT_GROUND; } else if ((theOwner is EntityMyself) && (action == ActionConstants.HIT_AIR || action == ActionConstants.KNOCK_DOWN)) { int random = Mogo.Util.RandomHelper.GetRandomInt(0, 100); if (random <= 70) {//主角受到倒地状态影响时,只有30%机会成功,否则变成普通受击 By.铭 action = ActionConstants.HIT; } } theOwner.SetAction(action); EventDispatcher.TriggerEvent(Events.LogicSoundEvent.OnHitYelling, theOwner as EntityParent, action); // 回调函数, 切换到 idle TimerHeap.AddTimer<EntityParent, int>(100, 0, (_theOwner, _hitAct) => { if (_theOwner == null) { return; } if (_theOwner.motor != null) { _theOwner.motor.CancleLookAtTarget(); } //_theOwner.TriggerUniqEvent<int>(Events.FSMMotionEvent.OnHitAnimEnd, _hitAct); if (_theOwner is EntityMyself) { _theOwner.SetSpeed(0); _theOwner.motor.SetSpeed(0); } }, theOwner, hitActionID ); }
// 状态处理 public void Process(EntityParent theOwner, params System.Object[] args) { theOwner.SetAction(4); }