private static Material MatFromColorPct(float colorPct, bool transparent) { int num = Mathf.RoundToInt(colorPct * 100f); num = GenMath.PositiveMod(num, 100); return(DebugMatsSpectrum.Mat(num, transparent)); }
public static Rot4 FromAngleFlat(float angle) { angle = GenMath.PositiveMod(angle, 360f); Rot4 result; if (angle < 45f) { result = Rot4.North; } else if (angle < 135f) { result = Rot4.East; } else if (angle < 225f) { result = Rot4.South; } else if (angle < 315f) { result = Rot4.West; } else { result = Rot4.North; } return(result); }
private static Material MatFromColorPct(float colorPct, bool transparent) { int x = Mathf.RoundToInt((float)(colorPct * 100.0)); x = GenMath.PositiveMod(x, 100); return(DebugMatsSpectrum.Mat(x, transparent)); }
public static Rot4 FromAngleFlat(float angle) { angle = GenMath.PositiveMod(angle, 360f); if (angle < 45f) { return(Rot4.North); } if (angle < 135f) { return(Rot4.East); } if (angle < 225f) { return(Rot4.South); } if (angle < 315f) { return(Rot4.West); } return(Rot4.North); }
private static void CalculateNeededLOSToCells(IntVec3 position, Map map, float direction, out IntVec3?needLOSToCell1, out IntVec3?needLOSToCell2) { needLOSToCell1 = null; needLOSToCell2 = null; if (position.CanBeSeenOverFast(map)) { return; } direction = GenMath.PositiveMod(direction, 360f); IntVec3 intVec = position; intVec.z++; IntVec3 intVec2 = position; intVec2.z--; IntVec3 intVec3 = position; intVec3.x--; IntVec3 intVec4 = position; intVec4.x++; if (direction < 90f) { if (intVec3.InBounds(map) && intVec3.CanBeSeenOverFast(map)) { needLOSToCell1 = intVec3; } if (intVec.InBounds(map) && intVec.CanBeSeenOverFast(map)) { needLOSToCell2 = intVec; } } else if (direction < 180f) { if (intVec.InBounds(map) && intVec.CanBeSeenOverFast(map)) { needLOSToCell1 = intVec; } if (intVec4.InBounds(map) && intVec4.CanBeSeenOverFast(map)) { needLOSToCell2 = intVec4; } } else if (direction < 270f) { if (intVec4.InBounds(map) && intVec4.CanBeSeenOverFast(map)) { needLOSToCell1 = intVec4; } if (intVec2.InBounds(map) && intVec2.CanBeSeenOverFast(map)) { needLOSToCell2 = intVec2; } } else { if (intVec2.InBounds(map) && intVec2.CanBeSeenOverFast(map)) { needLOSToCell1 = intVec2; } if (intVec3.InBounds(map) && intVec3.CanBeSeenOverFast(map)) { needLOSToCell2 = intVec3; } } }
private static Material MatFromColorPct(float colorPct, bool transparent) { return(DebugMatsSpectrum.Mat(GenMath.PositiveMod(Mathf.RoundToInt(colorPct * 100f), 100), transparent)); }