private ActorAction CreateObj(ActorAction.ENType newType) { ActorAction action = m_pool.GetObjectFromPool(newType) as ActorAction; if (action != null) { return(action); } switch (newType) { case ActorAction.ENType.enStandAction: action = new StandAction(); break; //站立 case ActorAction.ENType.enMoveAction: action = new MoveAction(); break; //移动 case ActorAction.ENType.enAttackAction: action = new AttackAction(); break; //攻击 case ActorAction.ENType.enSpasticityAction: action = new SpasticityAction(); break; //被动僵直 case ActorAction.ENType.enBeAttackAction: action = new BeAttackAction(); break; //受击 case ActorAction.ENType.enUndownAction: action = new UndownAction(); break; //霸体 case ActorAction.ENType.enDeadAction: action = new DeadAction(); break; //死亡 case ActorAction.ENType.enReliveAction: action = new ReliveAction(); break; //复活 case ActorAction.ENType.enPlayEffectAction: action = new PlayEffectAction(); break; //播放特效 case ActorAction.ENType.enSearchEnemyAction: //action = new SearchEnemyAction(); break; //搜索敌人 case ActorAction.ENType.enTeleportAction: action = new TeleportAction(); break; //瞬移 case ActorAction.ENType.enControlMoveAction: action = new ControlMoveAction(); break; //控制技能定身 case ActorAction.ENType.enHoldDownAction: action = new HoldDownAction(); break; //按下状态 case ActorAction.ENType.enSelfSpasticityAction: action = new SelfSpasticityAction(); break; //主动僵直 case ActorAction.ENType.enAlertAction: action = new AlertAction(); break; //警戒 case ActorAction.ENType.enJumpinAction: action = new JumpinAction(); break; //入场 case ActorAction.ENType.enJumpoutAction: action = new JumpoutAction(); break; //退场 case ActorAction.ENType.enRollAction: action = new RollAction(); break; //翻滚 case ActorAction.ENType.enFakeBeAttackAction: action = new FakeBeAttackAction(); break; //假受击 case ActorAction.ENType.enActorExitAction: action = new ActorExitAction(); break; //主控角色退场 case ActorAction.ENType.enActorEnterAction: action = new ActorEnterAction(); break; //主控角色入场 case ActorAction.ENType.enControlAttackAction: action = new ControlAttackAction(); break; //不能攻击 case ActorAction.ENType.enControlBeAttackAction: action = new ControlBeAttackAction(); break; //不能受击 case ActorAction.ENType.enAttackingMoveAction: action = new AttackingMoveAction(); break;//攻击时移动 case ActorAction.ENType.enDragMoveAction: action = new DragMoveAction(); break;//拖拽 default: throw new Exception("Miss Action Create for" + newType.ToString()); } return(action); }
public override void Update() { Actor.Cmd cmd = Owner.CurrentCmd; if (cmd != null) { switch (cmd.m_type) { case Actor.ENCmdType.enMove: { if (ActionMoveTo(cmd.m_moveTargetPos, true, false, cmd.IsSyncPosValidate, cmd.m_syncPos)) { Owner.CurrentCmd = null; } } break; case Actor.ENCmdType.enSkill: { Owner.CurrentTarget = ActorManager.Singleton.Lookup(cmd.m_targetID); //ActionForwardTo(cmd.m_targetID); if (ActionTryAttack(cmd.m_skillID, Owner.CurrentTarget, cmd.IsSyncPosValidate, cmd.m_syncPos)) { Owner.CurrentCmd = null; } else { ActionForwardTo(cmd.m_targetID); } } break; case Actor.ENCmdType.enRoll: { RollAction rollAction = Owner.ActionControl.AddAction(ActorAction.ENType.enRollAction) as RollAction; if (rollAction != null) { rollAction.Init(Owner.CurrentCmd.m_syncPos, cmd.m_moveTargetPos); Owner.CurrentCmd = null; } break; } case Actor.ENCmdType.enActorEnter: { Player player = Owner as Player; if (player != null) { if (player.SwitchActorEnter(cmd.m_syncPos, cmd.m_forward)) { Owner.CurrentCmd = null; } } else { Owner.CurrentCmd = null; } break; } case Actor.ENCmdType.enActorExit: { Owner.IsActorExit = true; ActorExitAction actorExitAction = Owner.ActionControl.AddAction(ActorAction.ENType.enActorExitAction) as ActorExitAction; if (actorExitAction != null) { Owner.CurrentCmd = null; } break; } case Actor.ENCmdType.enInteruptAction: { Owner.ActionControl.InterruptAction((ActorAction.ENType)cmd.m_interruptedActionType); Owner.CurrentCmd = null; break; } case Actor.ENCmdType.enBeHitAction: { BeAttackAction beAttackAction = Owner.ActionControl.AddAction(ActorAction.ENType.enBeAttackAction) as BeAttackAction; if (beAttackAction != null) { Actor srcActor = ActorManager.Singleton.Lookup(cmd.m_srcActorID); beAttackAction.Init(srcActor, cmd.m_isBack, cmd.m_isFly); Owner.CurrentCmd = null; } break; } case Actor.ENCmdType.enJumpInAction: { Owner.CurrentTarget = ActorManager.Singleton.Lookup(cmd.m_targetID); JumpinAction jumpInAction = Owner.ActionControl.AddAction(ActorAction.ENType.enJumpinAction) as JumpinAction; if (jumpInAction != null) { Owner.CurrentCmd = null; } break; } case Actor.ENCmdType.enJumpOutAction: { JumpoutAction jumpOutAction = Owner.ActionControl.AddAction(ActorAction.ENType.enJumpoutAction) as JumpoutAction; if (jumpOutAction != null) { Owner.CurrentCmd = null; } break; } case Actor.ENCmdType.enAttackingMoveAction: { AttackingMoveAction action = Owner.ActionControl.AddAction(ActorAction.ENType.enAttackingMoveAction) as AttackingMoveAction; if (action != null) { action.InitImpl(Owner.CurrentCmd.m_skillID, Owner.CurrentCmd.m_targetID, cmd.IsSyncPosValidate, cmd.m_syncPos); Owner.CurrentCmd = null; } } break; } } }
float m_exitDuration = float.MinValue; //从入场到退场的间隔 public override void Update() { Player self = Owner as Player; if (null != self.CurrentCmd) { switch ((ENSwitchStep)BattleArena.Singleton.SwitchStep) { case ENSwitchStep.enNone: { JumpinAction action = self.ActionControl.AddAction(ActorAction.ENType.enJumpinAction) as JumpinAction; if (null == action) { Debug.LogWarning("JumpinAction add fail"); } else { BattleArena.Singleton.SwitchStep = ENSwitchStep.enJumpin; m_enterTimer = Time.time; } } break; case ENSwitchStep.enJumpin: { if (!self.ActionControl.IsActionRunning(ActorAction.ENType.enJumpinAction)) { //入场action已完成,释放切入技 float now = Time.time; if (m_enterTimer == 0.0f) { m_enterTimer = now; } else { if (m_exitDuration == float.MinValue) { WorldParamInfo info = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enSwitchExitTimer); if (info != null) { m_exitDuration = info.FloatTypeValue; } } if (now - m_enterTimer > m_exitDuration) { BattleArena.Singleton.SwitchStep = ENSwitchStep.enJumpout; return; } } //直接释放技能 if (ActionTryAttack(self.CurrentCmd.m_skillID, self.TargetManager.CurrentTarget)) { BattleArena.Singleton.SwitchStep = ENSwitchStep.enAttack; } //GetRangeTargetList(ENTargetType.enEnemy); //m_curTargetID = Owner.TargetManager.CurrentTarget.ID; //if (ActionTryFireSkill(self.CurrentCmd.m_skillID)) //{ // self.SwitchStep = Player.ENSwitchStep.enAttack; //} } } break; case ENSwitchStep.enAttack: { if (!self.ActionControl.IsActionRunning(ActorAction.ENType.enAttackAction)) { //攻击action已完成 JumpoutAction action = self.ActionControl.AddAction(ActorAction.ENType.enJumpoutAction) as JumpoutAction; if (null == action) { Debug.LogWarning("JumpoutAction add fail"); } else { BattleArena.Singleton.SwitchStep = ENSwitchStep.enJumpout; } } } break; case ENSwitchStep.enJumpout: { if (!self.ActionControl.IsActionRunning(ActorAction.ENType.enJumpoutAction)) { //退场action已完成 self.CurrentCmd = null; self.HideMe(); BattleArena.Singleton.SwitchStep = ENSwitchStep.enNone; //将切入技角色从ActorManager列表中删除,但不销毁 ActorManager.Singleton.ReleaseActor(self.ID, false); } } break; default: break; } } }