Пример #1
0
        public static MoteBubble MakeThoughtBubble(Pawn pawn, string iconPath, bool maintain = false)
        {
            ExistingMoteBubbleOn(pawn)?.Destroy();
            MoteBubble obj = (MoteBubble)ThingMaker.MakeThing(maintain ? ThingDefOf.Mote_ForceJobMaintained : ThingDefOf.Mote_ForceJob);

            obj.SetupMoteBubble(ContentFinder <Texture2D> .Get(iconPath), null);
            obj.Attach(pawn);
            GenSpawn.Spawn(obj, pawn.Position, pawn.Map);
            return(obj);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public static MoteBubble MakeSpeechBubble(Pawn initiator, Texture2D symbol)
        {
            MoteBubble moteBubble = ExistingMoteBubbleOn(initiator);

            if (moteBubble != null)
            {
                if (moteBubble.def == ThingDefOf.Mote_Speech)
                {
                    moteBubble.Destroy();
                }
                if (moteBubble.def == ThingDefOf.Mote_ThoughtBad || moteBubble.def == ThingDefOf.Mote_ThoughtGood)
                {
                    moteBubble.Destroy();
                }
            }
            MoteBubble obj = (MoteBubble)ThingMaker.MakeThing(ThingDefOf.Mote_Speech);

            obj.SetupMoteBubble(symbol, null);
            obj.Attach(initiator);
            GenSpawn.Spawn(obj, initiator.Position, initiator.Map);
            return(obj);
        }
Пример #5
0
        public static MoteBubble MakeMoodThoughtBubble(Pawn pawn, Thought thought)
        {
            if (Current.ProgramState != ProgramState.Playing)
            {
                return(null);
            }
            if (!pawn.Spawned)
            {
                return(null);
            }
            float num = thought.MoodOffset();

            if (num == 0f)
            {
                return(null);
            }
            MoteBubble moteBubble = 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();
                }
            }
            ThingDef   def         = (!(num > 0f)) ? ThingDefOf.Mote_ThoughtBad : ThingDefOf.Mote_ThoughtGood;
            MoteBubble moteBubble2 = (MoteBubble)ThingMaker.MakeThing(def);

            moteBubble2.SetupMoteBubble(thought.Icon, null);
            moteBubble2.Attach(pawn);
            GenSpawn.Spawn(moteBubble2, pawn.Position, pawn.Map);
            return(moteBubble2);
        }