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); }
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); } }
public override void Enter(StateController <GameManager.GameSystemType> owner, IStateArgument argument = null) { arenaSystem = Object.Instantiate(arenaSystemPrefab); }
public StateController(List <IState <TStateName> > states, TStateName initialStateName, IStateArgument argument = null) { this.states = states.ToDictionary(x => x.StateName); this.Change(initialStateName, argument); }
public abstract void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null);
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); }
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); }
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); }
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); }
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); }
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); } }
public override void Enter(StateController <BattleSystem.BattlePhase> owner, IStateArgument argument = null) { owner.Change(BattleSystem.BattlePhase.EnemySelectCommand); }