public static void ThrowTextMote(Vector3 loc, Map map, string text, Color color, float solidTime, float timeBeforeStartFadeout = -1f) { if (!loc.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority) { return; } MoteText moteText = (MoteText)ThingMaker.MakeThing(TorannMagicDefOf.Mote_1sText, null); moteText.rotationRate = 0; moteText.exactPosition = loc; moteText.text = text; moteText.textColor = color; moteText.def.mote.solidTime = solidTime; moteText.SetVelocity(0, 0); GenSpawn.Spawn(moteText, loc.ToIntVec3(), map); }
public static void ThrowText(Vector3 loc, Map map, string text, Color color, float timeBeforeStartFadeout = -1f) { IntVec3 intVec = loc.ToIntVec3(); if (intVec.InBounds(map)) { MoteText moteText = (MoteText)ThingMaker.MakeThing(ThingDefOf.Mote_Text, null); moteText.exactPosition = loc; moteText.SetVelocity((float)Rand.Range(5, 35), Rand.Range(0.42f, 0.45f)); moteText.text = text; moteText.textColor = color; if (timeBeforeStartFadeout >= 0.0) { moteText.overrideTimeBeforeStartFadeout = timeBeforeStartFadeout; } GenSpawn.Spawn(moteText, intVec, map); } }
public static void ThrowStaticText(Vector3 loc, Map map, string text, Color color, float timeBeforeStartFadeout = -1f) { IntVec3 intVec = loc.ToIntVec3(); if (!intVec.InBounds(map)) { return; } MoteText moteText = (MoteText)ThingMaker.MakeThing(ThingDefOf.Mote_Text, null); moteText.exactPosition = loc; moteText.text = text; moteText.textColor = color; if (timeBeforeStartFadeout >= 0f) { moteText.overrideTimeBeforeStartFadeout = timeBeforeStartFadeout; } GenSpawn.Spawn(moteText, intVec, map, WipeMode.Vanish); }
public void DisplayMaxFishStockMoteAt(Map map, IntVec3 position, Rot4 rotation) { if (position.InBounds(map) == false) { return; } // Get aquatic cells around the fishing spot. int aquaticCellsAround = Util_PlaceWorker.GetAquaticCellsInRadius(map, position + new IntVec3(0, 0, 2).RotatedBy(rotation), Building_FishingPier.aquaticAreaRadius) - 3; // 3 cells will actually be occupied by the pier. int aquaticCellsProportionInPercent = Mathf.RoundToInt(((float)aquaticCellsAround / (float)(GenRadial.NumCellsInRadius(Building_FishingPier.aquaticAreaRadius) - 3)) * 100f); Color textColor = Color.red; string aquaticCellsProportionAsText = ""; if (aquaticCellsAround < Util_Zone_Fishing.minCellsToSpawnFish) { aquaticCellsProportionAsText = "FishIndustry.FishingPier_TooFewWater".Translate(); } else { aquaticCellsProportionAsText = aquaticCellsProportionInPercent + "%"; if (aquaticCellsProportionInPercent >= 75) { textColor = Color.green; } else if (aquaticCellsProportionInPercent >= 50) { textColor = Color.yellow; } else if (aquaticCellsProportionInPercent >= 25) { textColor = new Color(255, 165, 0); // Orange color. } } MoteText moteText = (MoteText)ThingMaker.MakeThing(ThingDefOf.Mote_Text, null); moteText.exactPosition = position.ToVector3Shifted(); moteText.text = aquaticCellsProportionAsText; moteText.textColor = textColor; moteText.overrideTimeBeforeStartFadeout = 1f; GenSpawn.Spawn(moteText, position, map); lastMotePosition = position; }