/// <summary> /// マウスにモノのオーダーする部分。実質ここが初期化 /// </summary> /// <param name="arrangementTarget"></param> /// <param name="preMono"></param> public void OrderMaking(PlayerMouseViewModel playerMouseViewModel, PreMono preMono) { Debug.Assert(!IsOrdered(), "現在作成中のため追加で作成を行うことができません。"); this.currentPreMono = preMono; this.PlayerMouseViewModel = playerMouseViewModel; stateManager.Interrupt(new MoveToTarget(this, playerMouseViewModel.PlayerArrangementTargetModel)); }
/// <summary> /// プレイヤーデータから再度マウスの状態を決める場合 /// </summary> /// <param name="playerMouseViewModel"></param> /// <param name="preMono"></param> public void ReOrderMaking(PlayerMouseViewModel playerMouseViewModel, PreMono preMono) { Debug.Assert(!IsOrdered(), "現在作成中のため追加で作成を行うことができません。"); this.currentPreMono = preMono; this.PlayerMouseViewModel = playerMouseViewModel; // 状態変化による切り替え if (playerMouseViewModel.State == MouseViewState.Move) { stateManager.Interrupt(new MoveToTarget(this, playerMouseViewModel.PlayerArrangementTargetModel)); } else if (playerMouseViewModel.State == MouseViewState.Making) { stateManager.Interrupt(new MakingState(this, playerMouseViewModel.PlayerArrangementTargetModel)); this.currentPreMono.ProgressMaking(playerMouseViewModel.MakingAmount); } else if (playerMouseViewModel.State == MouseViewState.BackToHome) { stateManager.Interrupt(new BackToHomeState(this)); } else { Debug.Assert(false, "ありえない状態" + playerMouseViewModel.State.ToString()); } }
public void FinishMaking(PlayerArrangementTargetModel playerArrangementTargetModel) { if (!HasPreMono) { Debug.LogError("プレモノを持っていないのにMakeが呼ばれました"); } currentPreMono.FinishMaking(playerArrangementTargetModel); currentPreMono = null; }
// Start is called before the first frame update void Awake() { // 初期化 this.mouseParameter = new MouseParameter() { speed = 4.0f, }; // 状態遷移 this.stateManager = new StateManager(new EmptyState()); this.disposables.Add(this.stateManager.OnChangeStateObservable.Subscribe(state => { GameManager.Instance.MouseStockManager.ChangeState(this, state); })); this.currentPreMono = null; }