示例#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);
        }
示例#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);
                }
            }
示例#3
0
 public override void Enter(StateController <GameManager.GameSystemType> owner, IStateArgument argument = null)
 {
     arenaSystem = Object.Instantiate(arenaSystemPrefab);
 }
示例#4
0
 public StateController(List <IState <TStateName> > states, TStateName initialStateName, IStateArgument argument = null)
 {
     this.states = states.ToDictionary(x => x.StateName);
     this.Change(initialStateName, argument);
 }
示例#5
0
 public abstract void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null);
示例#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);
 }
示例#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);
            }
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     battleSystem.Player.StartTurn();
     owner.Change(BattleSystem.BattlePhase.PlayerSelectCommand);
 }
示例#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);
 }
示例#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);
 }
示例#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);
            }
示例#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);
                }
            }
示例#15
0
 public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null)
 {
     owner.Change(BattleSystem.BattlePhase.EnemySelectCommand);
 }