public void Setup() { // create private container container_ = new DiContainer(); container_.Bind <Reducer>().AsSingle(); // set up mock settings var mockSettings = new Settings { }; container_.Bind <Settings>().FromInstance(mockSettings); // stub move action mockMoveAction_ = new Action.Move { inputVelocity = Vector2.up.normalized, fixedDeltaTime = 1.0f }; // stub turn action mockTurnAction_ = new Action.Turn { inputRotation = Vector2.up, fixedDeltaTime = 1.0f }; // stub state condition mockCharacterState_ = new CharacterState { isMoving = false, isTurning = false, moveDistance = Vector3.zero, transformForward = Vector3.forward, transformRight = Vector3.right, localRotation = Quaternion.identity }; }
// TODO: clone state /* calculate distance from velocity and transform */ private CharacterState Move(CharacterState state, Action.Move action) { var inputVelocity = action.inputVelocity; var playerVelocity = (inputVelocity.x * state.transformRight) + (inputVelocity.y * state.transformForward); var distance = playerVelocity * action.fixedDeltaTime; state.isMoving = true; state.isTurning = false; state.moveDistance = distance; // Debug.Log($"in Move, returning state: {ObjectDumper.Dump(state)}"); return(state); }