virtual public void FromAngle(float angle) { DisableAll(); /** * Splitting a circle in 16 parts * I can use every couple of pieces to have the circle split giving equal priority * To each cardinal side of a D-Pad. later increased the size of the north, south, east, and west * cardinals so it feels better. */ float DiagonalPriority = ControllerSettings.DPAD_FROM_ANGLE_MODIFIER_IN_RADIANS; if (angle < Trigonometry.CardinalDirection(ZONE_ONE + DiagonalPriority) && angle >= Trigonometry.CardinalDirection(-ZONE_ONE - DiagonalPriority)) { _rightKey = true; } else if ((angle >= Trigonometry.CardinalDirection(ZONE_FOUR - DiagonalPriority) && angle <= Trigonometry.CardinalDirection(OUTSIDE_OF_ZONES)) || (angle >= Trigonometry.CardinalDirection(-OUTSIDE_OF_ZONES) && angle <= Trigonometry.CardinalDirection(-ZONE_FOUR + DiagonalPriority))) { _leftKey = true; } else if (angle >= Trigonometry.CardinalDirection(ZONE_TWO - DiagonalPriority) && angle < Trigonometry.CardinalDirection(ZONE_THREE + DiagonalPriority)) { _downKey = true; } else if (angle >= Trigonometry.CardinalDirection(-ZONE_THREE - DiagonalPriority) && angle < Trigonometry.CardinalDirection(-ZONE_TWO + DiagonalPriority)) { _upKey = true; } else if (angle >= Trigonometry.CardinalDirection(-ZONE_TWO) && angle < Trigonometry.CardinalDirection(-ZONE_ONE)) { _upKey = true; _rightKey = true; } else if (angle >= Trigonometry.CardinalDirection(ZONE_ONE) && angle < Trigonometry.CardinalDirection(ZONE_TWO)) { _rightKey = true; _downKey = true; } else if (angle >= Trigonometry.CardinalDirection(ZONE_THREE) && angle < Trigonometry.CardinalDirection(ZONE_FOUR)) { _downKey = true; _leftKey = true; } else if (angle >= Trigonometry.CardinalDirection(-ZONE_FOUR) && angle < Trigonometry.CardinalDirection(-ZONE_THREE)) { _leftKey = true; _upKey = true; } }