예제 #1
0
        public override void DrawWorker(Vector3 loc, Rot4 rot, ThingDef thingDef, Thing thing, float extraRotation)
        {
            if (thingDef == null)
            {
                Log.ErrorOnce("Fire DrawWorker with null thingDef: " + loc, 3427324);
                return;
            }
            if (this.subGraphics == null)
            {
                Log.ErrorOnce("Graphic_Flicker has no subgraphics " + thingDef, 358773632);
                return;
            }
            int   num  = Find.TickManager.TicksGame;
            int   num2 = 0;
            int   num3 = 0;
            float num4 = 1f;
            CompLightableFireOverlay CompLightableFireOverlay = null;

            if (thing != null)
            {
                CompLightableFireOverlay = thing.TryGetComp <CompLightableFireOverlay>();
                num += Mathf.Abs(thing.thingIDNumber ^ 8453458);
                num2 = num / 15;
                num3 = Mathf.Abs(num2 ^ thing.thingIDNumber * 391) % this.subGraphics.Length;
                Fire fire = thing as Fire;
                if (fire != null)
                {
                    num4 = fire.fireSize;
                }
                else if (CompLightableFireOverlay != null)
                {
                    num4 = CompLightableFireOverlay.Props.fireSize;
                }
            }
            if (num3 < 0 || num3 >= this.subGraphics.Length)
            {
                Log.ErrorOnce("Fire drawing out of range: " + num3, 7453435);
                num3 = 0;
            }
            Graphic graphic = this.subGraphics[num3];
            float   num5    = Mathf.Min(num4 / 1.2f, 1.2f);
            Vector3 a       = GenRadial.RadialPattern[num2 % GenRadial.RadialPattern.Length].ToVector3() / GenRadial.MaxRadialPatternRadius;

            a *= 0.05f;
            Vector3 vector = loc + a * num4;

            if (CompLightableFireOverlay != null)
            {
                vector += CompLightableFireOverlay.Props.offset;
            }
            Vector3   s      = new Vector3(num5, 1f, num5);
            Matrix4x4 matrix = default(Matrix4x4);

            matrix.SetTRS(vector, Quaternion.identity, s);
            Graphics.DrawMesh(MeshPool.plane10, matrix, graphic.MatSingle, 0);
        }
예제 #2
0
        public static void ToggleFireOverlay(Thing t, Map map)
        {
            CompLightableFireOverlay comp = t.TryGetComp <CompLightableFireOverlay>();

            if (comp is CompLightableFireOverlay)
            {
                comp.Toggle();
                return;
            }

            Log.Warning("should have found a CompFireOverlay but no CompFireOverlay found");
        }
예제 #3
0
        public static void ToggleFireOverlay(Thing t, Map map)
        {
            CompLightableFireOverlay comp = t.TryGetComp <CompLightableFireOverlay>();

            if (comp is CompLightableFireOverlay)
            {
                comp.Toggle();
            }
            else
            {
                Tools.Warn("should have found a CompFireOverlay but no CompFireOverlay found", true);
            }
        }
예제 #4
0
        public static void SetFireOverlay(Thing t, Map map, bool value = true)
        {
            CompLightableFireOverlay comp = t.TryGetComp <CompLightableFireOverlay>();

            if (comp is CompLightableFireOverlay)
            {
                //Log.Warning("Trying to set fire overlay:" + value, true);
                comp.SetBurn(value);
                return;
            }

            Log.Warning("should have found a CompFireOverlay but no CompFireOverlay found");
        }