protected override IEnumerator <CustomYieldInstruction> Execute(StageContext context, MoveAction action) { var character = context.CharacterService.GetCharacter(action.Id); character.Controller.Move(action.Position); yield break; }
void LoadStageContext(int Stage, StageType type) { if (m_Contxt != null) { GameObject.DestroyImmediate(m_Contxt.gameObject); m_Contxt = null; } string text = "StageContext_"; if (type == StageType.Hard) { text = "HardStageContext_"; } GameObject go = GameObjectLoader.LoadPath("Prefabs/Stage/", text + m_Chapter, MyHead.transform); if (go == null) { NGUIUtil.ShowFreeSizeTipWnd(20000000, null, 10); return; } GameObjectLoader.SetGameObjectLayer(go, MyHead.gameObject.layer); m_Contxt = go.GetComponent <StageContext>(); if (m_Contxt != null) { m_Contxt.SetStageContext(m_type, m_Chapter); } }
public Services(Transform canvas, Transform stage, JoystickController joystickController /*, Character.Character character*/) { var characterService = new CharacterService(); var stageContext = new StageContext(characterService); _actionService = new ActionService(stageContext); _clientService = new ClientService(_actionService, characterService, stage); _serverSerivce = new ServerSerivce(); _inputService = new InputService(_clientService, joystickController); PrefabLoader.LoadMenuUI(canvas, _serverSerivce, _clientService); }
private void Awake() { context = new StageContext(); calmnessStrategy = calmnessObj.GetComponent <CalmnessStrategy>(); frenzyStrategy = frenzyObj.GetComponent <FrenzyStrategy>(); reanimateStrategy = reanimateObj.GetComponent <ReanimateStrategy>(); demolishStrategy = demolishObj.GetComponent <DemolishStrategy>(); player = GameObject.Find("Player2").GetComponent <PirateController>(); currentState = State.Calmness; context.setStrategy(calmnessStrategy); context.executeStrategy(); }
void Awake() { context = new StageContext(); speed = 2.0f; playerEntity = GameObject.FindGameObjectsWithTag("Player")[0]; huntPlayerStrategy = huntObj.GetComponent <HuntPlayer>(); enemyIdleStrategy = idleObj.GetComponent <EnemyIdle>(); patrolZoneStrategy = patrolObj.GetComponent <PatrolZone>(); huntPlayerStrategy.setPlayerAndRigidBody(playerEntity, rb); enemyIdleStrategy.setPlayerAndRigidBody(playerEntity, rb); patrolZoneStrategy.setPlayerAndRigidBody(playerEntity, rb); animator = GetComponent <Animator>(); currentState = EnemyState.Patrol; context.setStrategy(enemyIdleStrategy); context.executeStrategy(); }
public ActionService(StageContext context) { _context = context; _handlers.Clear(); var types = GetType().Assembly.GetTypes(); foreach (var type in types) { if (IsValidHandler(type)) { var actionType = ExtensionActionType.TypeToActionType(type); if (actionType != EActionType.None) { if (_handlers.ContainsKey(actionType)) { Debug.LogError($"Duplicated action handler : {actionType}"); continue; } _handlers.Add(actionType, Activator.CreateInstance(type) as ActionHandler); } } } }
public abstract IEnumerator <CustomYieldInstruction> Execute(StageContext context, BaseAction baseAction);
protected void goToNextStage(System.Type nextStage, StageContext context) { NextStageType = nextStage; Context = context; }
/// <summary> /// Override this method to compose stage with components /// </summary> /// <param name="context">Previous stage passes current context that explains why and how next stage loads</param> public virtual void OnStageEnter(StageContext context) { // enter }
protected override IEnumerator <CustomYieldInstruction> Execute(StageContext context, AttackAction action) { throw new NotImplementedException(); }
public override void OnStageEnter(StageContext context) { }