void Start() { Provider.Store.Subscribe(state => { Mode.ModeEnum nextMode = Mode.ModeGet(state); bool nextPlacementValid = PlacementValid.PlacementValidGet(state); if ( nextMode == _mode && nextPlacementValid == _placementValid ) { return; } _mode = nextMode; var firstPlacement = nextPlacementValid && !_placementValid; _placementValid = nextPlacementValid; if (firstPlacement) { var position = Global.placement + (new Vector3(0.0f, 0.1f, 0.0f)); transform.position = position; _renderer.enabled = true; } if (_mode == Mode.ModeEnum.Action) { _sphereColllider.enabled = true; var rb = gameObject.AddComponent <Rigidbody>(); rb.angularDrag = 0.0f; rb.velocity = Quaternion.Euler(Global.aimEulerAngles) * (new Vector3(0.0f, 0.0f, 1.1f)); } }); }
public static State Reducer(State state, Action action) { // UPDATE FOR EACH DUCK bool hasChanged = false; Mode.ModeEnum nextMode = Mode.Reducer(state.Mode, action); if (nextMode != state.Mode) { hasChanged = true; } bool nextPlacementValid = PlacementValid.Reducer(state.PlacementValid, action); if (nextPlacementValid != state.PlacementValid) { hasChanged = true; } int nextScore = Score.Reducer(state.Score, action); if (nextScore != state.Score) { hasChanged = true; } return(hasChanged ? new State( nextMode, nextPlacementValid, nextScore ) : state); }
// UPDATE FOR EACH DUCK public State( Mode.ModeEnum mode, bool placementValid, int score ) { Mode = mode; PlacementValid = placementValid; Score = score; }
void Start() { Provider.Store.Subscribe(state => { Mode.ModeEnum nextMode = Mode.ModeGet(state); if (nextMode == _mode) { return; } _mode = nextMode; _text.text = _mode.ToString(); }); }
void Start() { Provider.Store.Subscribe(state => { Mode.ModeEnum nextMode = Mode.ModeGet(state); bool nextPlacementValid = PlacementValid.PlacementValidGet(state); if (nextMode == _mode && nextPlacementValid == _placementValid) { return; } _mode = nextMode; _placementValid = nextPlacementValid; }); }
void Start() { Provider.Store.Subscribe(state => { Mode.ModeEnum nextMode = Mode.ModeGet(state); if (nextMode == _mode) { return; } _mode = nextMode; if (_mode == Mode.ModeEnum.Meshing) { _renderer.enabled = false; } }); }
void Start() { Provider.Store.Subscribe(state => { Mode.ModeEnum nextMode = Mode.ModeGet(state); if (nextMode == _mode) { return; } _mode = nextMode; if (_mode == Mode.ModeEnum.Meshing) { transform.position = Global.mZPosition; transform.localScale = Global.mZLocalScale; _mLSpatialMapper.enabled = true; } else { _mLSpatialMapper.enabled = false; } }); }
void Start() { Provider.Store.Subscribe(state => { Mode.ModeEnum nextMode = Mode.ModeGet(state); if ( nextMode == _mode ) { return; } _mode = nextMode; if (_mode == Mode.ModeEnum.Aim) { var position = Global.placement + (new Vector3(0.0f, 0.1f, 0.0f)); transform.position = position; _renderer.enabled = true; } if (_mode == Mode.ModeEnum.Action) { _renderer.enabled = false; } }); }
public Action(Provider.Actions type, Mode.ModeEnum payload) { this.Type = type; this.PayloadModeEnum = payload; }