public ActorAction AddAction(ActorAction.ENType newType) { if (!IsDisable(newType)) { bool isValidateActionState = false; for (int index = m_actionList.Count - 1; index >= 0; --index) { ActorAction item = m_actionList[index]; if (!item.IsEnable) { continue; } if (ActorAction.ENRelation.enReplace == CheckRelation(newType, item.GetActionType())) { m_actionList.RemoveAt(index); isValidateActionState = true; item.OnInterupt(); RemoveDisableCount(item.GetActionType()); item.IsEnable = false; ReleaseObj(item); } } ActorAction obj = CreateObj(newType); obj.CurrentActor = CurrentActor; if (null != CurrentActor.mActorBlendAnim) { CurrentActor.mActorBlendAnim.CurActionType = newType; } ActioningObjArray[(int)newType] = obj; m_actionList.Add(obj); AddDisableCount(obj.GetActionType()); if (isValidateActionState) { for (int i = 0; i < ActioningArray.Length; i++) { ActioningArray[i] = 0; ActioningObjArray[i] = null; } for (int i = 0; i < m_actionList.Count; i++) { ActorAction ac = m_actionList[i]; ActioningObjArray[(int)ac.GetActionType()] = ac; ActioningArray[(int)ac.GetActionType()]++; } } return(obj); } else { string currentActions = CurrentActor.GetType() + ":" + newType.ToString() + " Current Actions:"; foreach (ActorAction action in m_actionList) { currentActions += action.GetActionType().ToString() + ", "; } //Debug.LogWarning("Add action failed:" + newType.ToString()+" actor type:"+CurrentActor.Type.ToString()); return(null); } }
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); }