public static MoteBubble MakeMoodThoughtBubble(Pawn pawn, Thought thought) { MoteBubble result; if (Current.ProgramState != ProgramState.Playing) { result = null; } else if (!pawn.Spawned) { result = null; } else { float num = thought.MoodOffset(); if (num == 0f) { result = null; } else { MoteBubble moteBubble = MoteMaker.ExistingMoteBubbleOn(pawn); if (moteBubble != null) { if (moteBubble.def == ThingDefOf.Mote_Speech) { return(null); } if (moteBubble.def == ThingDefOf.Mote_ThoughtBad || moteBubble.def == ThingDefOf.Mote_ThoughtGood) { moteBubble.Destroy(DestroyMode.Vanish); } } ThingDef def = (num <= 0f) ? ThingDefOf.Mote_ThoughtBad : ThingDefOf.Mote_ThoughtGood; MoteBubble moteBubble2 = (MoteBubble)ThingMaker.MakeThing(def, null); moteBubble2.SetupMoteBubble(thought.Icon, null); moteBubble2.Attach(pawn); GenSpawn.Spawn(moteBubble2, pawn.Position, pawn.Map, WipeMode.Vanish); result = moteBubble2; } } return(result); }
public static MoteBubble MakeInteractionBubble(Pawn initiator, Pawn recipient, ThingDef interactionMote, Texture2D symbol) { MoteBubble moteBubble = MoteMaker.ExistingMoteBubbleOn(initiator); if (moteBubble != null) { if (moteBubble.def == ThingDefOf.Mote_Speech) { moteBubble.Destroy(DestroyMode.Vanish); } if (moteBubble.def == ThingDefOf.Mote_ThoughtBad || moteBubble.def == ThingDefOf.Mote_ThoughtGood) { moteBubble.Destroy(DestroyMode.Vanish); } } MoteBubble moteBubble2 = (MoteBubble)ThingMaker.MakeThing(interactionMote, null); moteBubble2.SetupMoteBubble(symbol, recipient); moteBubble2.Attach(initiator); GenSpawn.Spawn(moteBubble2, initiator.Position, initiator.Map); return(moteBubble2); }