protected override void OnAdd(GUnit unit) { var unitData = unit.GetData <UnitData>(); var controlStateData = unit.GetData <ObjectControlStateData>(); var controlProcessData = unit.GetData <ObjectKeyboardControlProcessData>(); var stateProcessData = unit.GetData <ObjectStateProcessData>(); controlStateData.stateType.Subscribe(controlStateType => { if (controlStateType == ObjectControlStateType.Start) { controlProcessData.checkDispose = GameSystem.ObserveEveryUpdate().Subscribe(_ => { foreach (var controlData in controlProcessData.controlDataList) { if (Input.GetKeyDown(controlData.key)) { ObjectControlStateTypeDict.Set(unit, controlData.controlType, KeyStateType.Down); ObjectControlState.CheckAllControl(unit, controlData.controlType, controlStateData, stateProcessData); } else if (Input.GetKeyUp(controlData.key)) { ObjectControlStateTypeDict.Set(unit, controlData.controlType, KeyStateType.Up); ObjectControlState.CheckAllControl(unit, controlData.controlType, controlStateData, stateProcessData); ObjectControlStateTypeDict.Set(unit, controlData.controlType, KeyStateType.None); } } }); } else if (controlStateType == ObjectControlStateType.Finish) { controlProcessData.checkDispose?.Dispose(); } }).AddTo(unitData.disposable); }