internal ThumbstickState NextState(Vector2 position, bool clicked, float elapsed) { return(new ThumbstickState(position, position - Position, Clicked.NextState(clicked, elapsed), Up.NextState(Mathf.Clamp01(position.y) > PressThreshold, elapsed), Down.NextState(Mathf.Clamp01(-position.y) > PressThreshold, elapsed), Left.NextState(Mathf.Clamp01(-position.x) > PressThreshold, elapsed), Right.NextState(Mathf.Clamp01(position.x) > PressThreshold, elapsed))); }
internal DirectionalState NextState(bool up, bool down, bool left, bool right, float elapsed) { var direction = new Vector2(left ? -1 : right ? 1 : 0, up ? 1 : down ? -1 : 0); return(new DirectionalState(direction, direction - Direction, Up.NextState(up, elapsed), Down.NextState(down, elapsed), Left.NextState(left, elapsed), Right.NextState(right, elapsed))); }