public CubeCoordinatesInt(CubeCoordinatesFloat cubeCoordinatesFloat, RoundingMethod roundingMethod) { int qInt; int rInt; switch (roundingMethod) { case RoundingMethod.Ceil: qInt = Mathf.CeilToInt(cubeCoordinatesFloat.Q); rInt = Mathf.CeilToInt(cubeCoordinatesFloat.R); break; case RoundingMethod.Floor: qInt = Mathf.FloorToInt(cubeCoordinatesFloat.Q); rInt = Mathf.FloorToInt(cubeCoordinatesFloat.R); break; default: throw new ArgumentOutOfRangeException(nameof(roundingMethod), roundingMethod, null); } Q = qInt; R = rInt; S = -qInt - rInt; }
public bool Equals(CubeCoordinatesFloat other) { return(Mathf.Approximately(Q, other.Q) && Mathf.Approximately(S, other.S) && Mathf.Approximately(R, other.R)); }