private void InitActions(Entity owner, List <StateAction> actions, StateActionType type) { int count = actions.Count; for (int i = 0; i < count; i++) { BaseStateAction newAction = actions[i].CreateActionClass(owner); PopualteActions(newAction, type); } }
public virtual BaseStateAction CreateActionClass(Entity owner) { BaseStateAction action = null; switch (actionType) { case ActionType.PlayerMove: action = new PlayerMoveAction(owner, runUpdate); break; case ActionType.PlayerJump: action = new PlayerJumpAction(owner, runUpdate); break; case ActionType.PlayerDash: action = new PlayerDashAction(owner, runUpdate); break; case ActionType.MobWander: action = new WanderAction(owner, runUpdate); break; case ActionType.MobTurnAtLedge: action = new TurnAtLedgeAction(owner, runUpdate); break; case ActionType.MobTurnAtWall: action = new TurnAtWallAction(owner, runUpdate); break; case ActionType.MobFaceTarget: action = new ChaseTargetAction(owner, runUpdate); break; case ActionType.MobMoveNormal: action = new MoveAction(owner, runUpdate); break; default: action = new BaseStateAction(owner, runUpdate); break; } action.PopulateAbilities(abilities); return(action); }
private void PopualteActions(BaseStateAction action, StateActionType type) { switch (type) { case StateActionType.Enter: _OnEnterActions.Add(action); break; case StateActionType.Exit: _OnExitActions.Add(action); break; case StateActionType.Update: _OnUpdateActions.Add(action); break; case StateActionType.Fixed: _OnFixedUpdateActions.Add(action); break; } }