Exemplo n.º 1
0
        public void Change(TStateName stateName, IStateArgument argument = null)
        {
            if (this.current != null)
            {
                this.current.Exit();
                this.current.ActiveDisposables.Clear();
            }

            Assert.IsTrue(this.states.ContainsKey(stateName), $"{stateName}という{nameof(IState<TStateName>)}は存在しません");
            this.current = this.states[stateName];
            this.current.Enter(this, argument);
        }
Exemplo n.º 2
0
            public override void Enter(StateController <GameManager.GameSystemType> owner, IStateArgument argument = null)
            {
                this.fieldSystem = Object.Instantiate(fieldSystemPrefab);

                var arg = argument as Argument;

                if (arg != null)
                {
                    fieldSystem.Setup(arg.fieldDataId, arg.initialPosition);
                }
            }
Exemplo n.º 3
0
 public override void Enter(StateController <GameManager.GameSystemType> owner, IStateArgument argument = null)
 {
     arenaSystem = Object.Instantiate(arenaSystemPrefab);
 }
Exemplo n.º 4
0
 public StateController(List <IState <TStateName> > states, TStateName initialStateName, IStateArgument argument = null)
 {
     this.states = states.ToDictionary(x => x.StateName);
     this.Change(initialStateName, argument);
 }
Exemplo n.º 5
0
 public abstract void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null);
Exemplo n.º 6
0
 public abstract void Enter(StateController <GameManager.GameSystemType> owner, IStateArgument argument = null);
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     battleSystem.UIView.SetCommandButtonInteractable(true);
     battleSystem.UIView.SelectCommandAsObservable()
     .Subscribe(x =>
     {
         var arg = new InvokeCommand.Argument
         {
             command        = x.Command,
             commandInvoker = battleSystem.Player,
             completeInvokeCommandAction = () => owner.Change(BattleSystem.BattlePhase.PlayerTurnEnd)
         };
         x.ResetCoolTime();
         owner.Change(BattleSystem.BattlePhase.InvokeCommand, arg);
     })
     .AddTo(ActiveDisposables);
 }
Exemplo n.º 8
0
            public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
            {
                battleSystem.AddLog("TODO:バトル終了");

                Observable.Timer(TimeSpan.FromSeconds(3.0f))
                .Subscribe(_ =>
                {
                    GameManager.Instance.StateController.Change(GameManager.GameSystemType.Field);
                });
            }
            public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
            {
                var arg = new InvokeCommand.Argument
                {
                    command        = battleSystem.Enemy.GetCommand(),
                    commandInvoker = battleSystem.Enemy,
                    completeInvokeCommandAction = () => owner.Change(BattleSystem.BattlePhase.EnemyTurnEnd)
                };

                owner.Change(BattleSystem.BattlePhase.InvokeCommand, arg);
            }
Exemplo n.º 10
0
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     battleSystem.Player.StartTurn();
     owner.Change(BattleSystem.BattlePhase.PlayerSelectCommand);
 }
Exemplo n.º 11
0
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     battleSystem.Enemy.EndTurn()
     .Subscribe(_ =>
     {
         if (battleSystem.CanEnd())
         {
             owner.Change(BattleSystem.BattlePhase.End);
         }
         else
         {
             owner.Change(BattleSystem.BattlePhase.PlayerTurnStart);
         }
     })
     .AddTo(ActiveDisposables);
 }
Exemplo n.º 12
0
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     battleSystem.Player.StartBattle()
     .Subscribe();
     battleSystem.Enemy.StartBattle()
     .Subscribe();
     battleSystem.UIView.EnemyStatusView.Setup(battleSystem.Enemy);
     battleSystem.UIView.PlayerStatusView.Setup(battleSystem.Player);
     battleSystem.UIView.CreateCommandButton(battleSystem.Player.Commands);
     battleSystem.UIView.SetCommandButtonInteractable(false);
     owner.Change(BattleSystem.BattlePhase.PlayerTurnStart);
 }
Exemplo n.º 13
0
            public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
            {
                var arg = (Argument)argument;

                Assert.IsNotNull(arg);

                battleSystem.UIView.SetCommandButtonInteractable(false);
                battleSystem.InvokeCommand(arg.commandInvoker, arg.command)
                .Subscribe(x =>
                {
                    if (battleSystem.CanEnd())
                    {
                        owner.Change(BattleSystem.BattlePhase.End);
                    }
                }, () =>
                {
                    if (!battleSystem.CanEnd())
                    {
                        arg.completeInvokeCommandAction();
                    }
                })
                .AddTo(ActiveDisposables);
            }
Exemplo n.º 14
0
            public override void Enter(StateController <GameManager.GameSystemType> owner, IStateArgument argument = null)
            {
                this.battleSystem = Object.Instantiate(this.battleSystemPrefab);
                var arg = argument as Argument;

                if (arg != null)
                {
                    battleSystem.Setup(arg.enemyId);
                }
            }
Exemplo n.º 15
0
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     owner.Change(BattleSystem.BattlePhase.EnemySelectCommand);
 }