コード例 #1
0
        protected override IEnumerator <CustomYieldInstruction> Execute(StageContext context, MoveAction action)
        {
            var character = context.CharacterService.GetCharacter(action.Id);

            character.Controller.Move(action.Position);
            yield break;
        }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
        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);
        }
コード例 #4
0
    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();
    }
コード例 #5
0
    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();
    }
コード例 #6
0
        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);
                    }
                }
            }
        }
コード例 #7
0
 public abstract IEnumerator <CustomYieldInstruction> Execute(StageContext context, BaseAction baseAction);
コード例 #8
0
ファイル: GameStage.cs プロジェクト: seokmin/TESTUDO2
 protected void goToNextStage(System.Type nextStage, StageContext context)
 {
     NextStageType = nextStage;
     Context       = context;
 }
コード例 #9
0
ファイル: GameStage.cs プロジェクト: seokmin/TESTUDO2
 /// <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
 }
コード例 #10
0
 protected override IEnumerator <CustomYieldInstruction> Execute(StageContext context, AttackAction action)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
ファイル: GameStageLaunch.cs プロジェクト: seokmin/TESTUDO2
 public override void OnStageEnter(StageContext context)
 {
 }