Exemple #1
0
        /// <summary>
        /// Get parameters from XML.
        /// </summary>
        public void GetParametersFromXml()
        {
            Projectile_Laser.ThingDef_LaserProjectile additionalParameters = def as Projectile_Laser.ThingDef_LaserProjectile;

            // Miscellaneous.
            if (additionalParameters.warmupProjectileDefName != null)
            {
                warmupProjectileDefName = additionalParameters.warmupProjectileDefName;
            }
            isWarmupProjectile = additionalParameters.isWarmupProjectile;
            preFiringDuration  = additionalParameters.preFiringDuration;
            postFiringDuration = additionalParameters.postFiringDuration;

            // Draw.
            preFiringInitialIntensity  = additionalParameters.preFiringInitialIntensity;
            preFiringFinalIntensity    = additionalParameters.preFiringFinalIntensity;
            postFiringInitialIntensity = additionalParameters.postFiringInitialIntensity;
            postFiringFinalIntensity   = additionalParameters.postFiringFinalIntensity;
            if (additionalParameters.warmupGraphicPathSingle != null)
            {
                warmupTexture = MaterialPool.MatFrom(additionalParameters.warmupGraphicPathSingle, ShaderDatabase.Transparent);
            }

            // Sound.
            if (additionalParameters.warmupSound != null)
            {
                warmupSound = SoundDef.Named(additionalParameters.warmupSound);
            }
        }
Exemple #2
0
        public override void TickOverlay(Map map)
        {
            if (curWeather != map.weatherManager.curWeather)
            {
                curWeather = map.weatherManager.curWeather;
                var extension = curWeather.GetModExtension <WeatherOverlayExtensionTwo>();
                if (extension != null)
                {
                    worldOverlayPanSpeed1 = extension.worldOverlayPanSpeed1;
                    worldPanDir1          = extension.worldPanDir1;
                    worldPanDir1.Normalize();
                    worldOverlayPanSpeed2 = extension.worldOverlayPanSpeed2;
                    worldPanDir2          = extension.worldPanDir2;
                    worldPanDir2.Normalize();
                    worldOverlayMat = MaterialPool.MatFrom(extension.overlayPath);
                    var mat = MatLoader.LoadMat(extension.copyPropertiesFrom);
                    worldOverlayMat.CopyPropertiesFromMaterial(mat);
                    worldOverlayMat.shader = mat.shader;
                    var texture = ContentFinder <Texture2D> .Get(extension.overlayPath);

                    worldOverlayMat.SetTexture("_MainTex", texture);
                    worldOverlayMat.SetTexture("_MainTex2", texture);
                }
            }
            base.TickOverlay(map);
        }
Exemple #3
0
        public override void PostDraw()
        {
            base.PostDraw();


            var vector = parent.TrueCenter() + new Vector3(0, 3f, Props.size.x / 1.5f);

            var f       = spinPosition + (6.283185f * 1 / 9f);
            var x       = Mathf.Abs(4f * Mathf.Sin(f));
            var unused  = f % 6.283185f < 3.141593f;
            var unused1 = new Vector2(x, 1f);
            var s       = new Vector3(Props.size.x, 1f, Props.size.y);
            var matrix  = new Matrix4x4();

            matrix.SetTRS(vector, parent.Rotation.AsQuat, s);
            if (hasPower() && !isATK())
            {
                Graphics.DrawMesh(MeshPool.plane10Flip, matrix, getMat(), 0);
            }
            else
            {
                Graphics.DrawMesh(MeshPool.plane10Flip, matrix, MaterialPool.MatFrom(path + "0"), 0);
            }


            // Log.Warning("now index is "+getMat());
        }
        public static Material[] GetMatsFrom(GraphicRequest req, Texture2D[] inputTextureArray, Texture2D[] inputMaskArray)
        {
            Material[] matArray = new Material[inputTextureArray.Length];

            for (int i = 0; i < inputTextureArray.Length; i++)
            {
                if (inputTextureArray[i] != null)
                {
                    Texture2D mask;
                    if (inputMaskArray[i] != null)
                    {
                        mask = inputMaskArray[i];
                    }
                    else
                    {
                        mask = HairMasker.GetDefaultMask(inputTextureArray[i].width, inputTextureArray[i].height);
                    }

                    MaterialRequest tempMatReq = default(MaterialRequest);
                    tempMatReq.mainTex          = inputTextureArray[i];
                    tempMatReq.shader           = req.shader;
                    tempMatReq.color            = req.color;
                    tempMatReq.colorTwo         = req.colorTwo;
                    tempMatReq.maskTex          = mask;
                    tempMatReq.shaderParameters = req.shaderParameters;

                    matArray[i] = MaterialPool.MatFrom(tempMatReq);
                }
            }

            return(matArray);
        }
 public override void Tick()
 {
     base.Tick();
     start--;
     if (start == 0)
     {
         armed         = true;
         this.armedgfc = new Graphic_Single(MaterialPool.MatFrom("Things/Weapons/APM_armed"), false);
         Find.MapDrawer.MapChanged(Position, MapChangeType.Things);
     }
     if (armed == true)
     {
         delay--;
         if (delay == 1)
         {
             foreach (IntVec3 current in GenAdj.AdjacentCells8Way(Position))
             {
                 foreach (Thing thing in Find.ThingGrid.ThingsAt(current))
                 {
                     if (thing is Pawn)
                     {
                         this.Command_Detonate();
                         delay = 30;
                     }
                 }
             }
         }
         else if (delay == 0)
         {
             delay = 30;
         }
     }
 }
        public StatDef ResistHediffStat = null;  //The default chance of adding a hediff.

        void CreateGraphics()
        {
            if (this.graphicData.graphicClass == typeof(Graphic_Random) || this.graphicData.graphicClass == typeof(Graphic_Flicker))
            {
                for (int i = 0; i < textures.Count; i++)
                {
                    List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(textures[i])
                                             where !x.name.EndsWith(Graphic_Single.MaskSuffix)
                                             orderby x.name
                                             select x).ToList <Texture2D>();
                    if (list.NullOrEmpty <Texture2D>())
                    {
                        Log.Error("Collection cannot init: No textures found at path " + textures[i], false);
                    }
                    for (int ii = 0; ii < list.Count; ii++)
                    {
                        materials.Add(MaterialPool.MatFrom(textures[i] + "/" + list[ii].name, this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam));
                    }
                }
            }
            else
            {
                for (int i = 0; i < textures.Count; i++)
                {
                    materials.Add(MaterialPool.MatFrom(textures[i], this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam));
                }
            }
            if (!flareMatPath.NullOrEmpty())
            {
                flareMat = MaterialPool.MatFrom(flareMatPath, this.flareShaderType?.Shader ?? this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam);
            }
        }
Exemple #7
0
        private Material LoadIconMat(string path, bool smooth = false)
        {
            Texture2D tex = ContentFinder <Texture2D> .Get("UI/Overlays/PawnStateIcons/" + path, false);

            Material material;

            if (tex == null)
            {
                material = null;
            }
            else
            {
                if (smooth)
                {
                    tex.filterMode = FilterMode.Trilinear;
                    tex.mipMapBias = -0.5f;
                    tex.anisoLevel = 9;
                    tex.wrapMode   = TextureWrapMode.Repeat;
                    tex.Apply();
                    tex.Compress(true);
                }
                else
                {
                    tex.filterMode = FilterMode.Point;
                    tex.wrapMode   = TextureWrapMode.Repeat;
                    tex.Apply();
                    tex.Compress(true);
                }
                material = MaterialPool.MatFrom(new MaterialRequest(tex, ShaderDatabase.MetaOverlay));
            }
            return(material);
        }
        public Material getShellMat()
        {
            // Material result = MaterialPool.MatFrom(path + "0");
            if (ticktime < 34910 && !canFire)
            {
                return(oldt);
            }

            if (!hasPower())
            {
                return(oldt);
            }

            if (ticktime % 4 != 0 && oldt != null)
            {
                return(oldt);
            }

            var req    = new MaterialRequest(list.RandomElement());
            var result = MaterialPool.MatFrom(req);

            oldt = result;
            return(result);

            // result = MaterialPool.MatFrom(path + index);
        }
        public void RenderMote()
        {
            float num = (Time.time - this.lastOrderedToTileTime) / 0.5f;

            if (num > 1f)
            {
                return;
            }
            if (Caravan_GotoMoteRenderer.cachedMaterial == null)
            {
                Caravan_GotoMoteRenderer.cachedMaterial = MaterialPool.MatFrom((Texture2D)Caravan_GotoMoteRenderer.FeedbackGoto.mainTexture, Caravan_GotoMoteRenderer.FeedbackGoto.shader, Color.white, WorldMaterials.DynamicObjectRenderQueue);
            }
            WorldGrid worldGrid  = Find.WorldGrid;
            Vector3   tileCenter = worldGrid.GetTileCenter(this.tile);
            Color     value      = new Color(1f, 1f, 1f, 1f - num);

            Caravan_GotoMoteRenderer.propertyBlock.SetColor(ShaderPropertyIDs.Color, value);
            Vector3  pos       = tileCenter;
            float    size      = 0.8f * worldGrid.averageTileSize;
            float    altOffset = 0.018f;
            Material material  = Caravan_GotoMoteRenderer.cachedMaterial;
            MaterialPropertyBlock materialPropertyBlock = Caravan_GotoMoteRenderer.propertyBlock;

            WorldRendererUtility.DrawQuadTangentialToPlanet(pos, size, altOffset, material, false, false, materialPropertyBlock);
        }
 void CreateGraphics()
 {
     if (this.graphicData.graphicClass == typeof(Graphic_Random) || this.graphicData.graphicClass == typeof(Graphic_Flicker))
     {
         for (int i = 0; i < textures.Count; i++)
         {
             List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(textures[i])
                                      where !x.name.EndsWith(Graphic_Single.MaskSuffix)
                                      orderby x.name
                                      select x).ToList <Texture2D>();
             if (list.NullOrEmpty <Texture2D>())
             {
                 Log.Error("Collection cannot init: No textures found at path " + textures[i], false);
             }
             for (int ii = 0; ii < list.Count; ii++)
             {
                 materials.Add(MaterialPool.MatFrom(textures[i] + "/" + list[ii].name, ShaderDatabase.TransparentPostLight));
             }
         }
     }
     else
     {
         for (int i = 0; i < textures.Count; i++)
         {
             materials.Add(MaterialPool.MatFrom(textures[i], ShaderDatabase.TransparentPostLight));
         }
     }
 }
Exemple #11
0
        public override void PostDraw()
        {
            base.PostDraw();


            Vector3 vector = base.parent.TrueCenter() + new Vector3(0, 3f, (this.Props.size.x) / 1.5f);;

            float     f       = this.spinPosition + ((6.283185f * 1) / 9f);
            float     x       = Mathf.Abs((float)(4f * Mathf.Sin(f)));
            bool      flag    = (f % 6.283185f) < 3.141593f;
            Vector2   vector2 = new Vector2(x, 1f);
            Vector3   s       = new Vector3(this.Props.size.x, 1f, this.Props.size.y);
            Matrix4x4 matrix  = new Matrix4x4();

            matrix.SetTRS(vector, base.parent.Rotation.AsQuat, s);
            if (hasPower() && !isATK())
            {
                Graphics.DrawMesh(MeshPool.plane10Flip, matrix, getMat(), 0);
            }
            else
            {
                Graphics.DrawMesh(MeshPool.plane10Flip, matrix, MaterialPool.MatFrom(path + "0"), 0);
            }



            // Log.Warning("now index is "+getMat());
        }
Exemple #12
0
 public override void Tick()
 {
     base.Tick();
     start--;
     if (start == 0)
     {
         armed         = true;
         this.armedgfc = new Graphic_Single(MaterialPool.MatFrom("Things/Weapons/APM_armed", true));
     }
     if (armed == true)
     {
         delay--;
         if (delay == 1)
         {
             foreach (IntVec3 current in GenAdj.AdjacentSquaresCardinal(this))
             {
                 foreach (Thing thing in Find.ThingGrid.ThingsAt(current))
                 {
                     if (thing is Pawn)
                     {
                         this.Command_Detonate();
                         delay = 30;
                     }
                 }
             }
         }
         else if (delay == 0)
         {
             delay = 30;
         }
     }
 }
 private void Init(Shader newShader, Color newColor)
 {
     _barrierHorizExtended  = MaterialPool.MatFrom(Textures.BarrierHorizExtended, newShader, newColor);
     _barrierVertExtended   = MaterialPool.MatFrom(Textures.BarrierVertExtended, newShader, newColor);
     _barrierHorizRetracted = MaterialPool.MatFrom(Textures.BarrierHorizRetracted, newShader, newColor);
     _barrierVertRetracted  = MaterialPool.MatFrom(Textures.BarrierVertRetracted, newShader, newColor);
 }
 public override void Draw()
 {
     base.Draw();
     if (iconMat != null)
     {
         Vector3 drawPos = DrawPos;
         drawPos.y += 0.01f;
         float alpha = Alpha;
         if (alpha <= 0f)
         {
             return;
         }
         Color instanceColor = base.instanceColor;
         instanceColor.a *= alpha;
         Material material = iconMat;
         if (instanceColor != material.color)
         {
             material = MaterialPool.MatFrom((Texture2D)material.mainTexture, material.shader, instanceColor);
         }
         Vector3   s      = new Vector3(def.graphicData.drawSize.x * 0.64f, 1f, def.graphicData.drawSize.y * 0.64f);
         Matrix4x4 matrix = default(Matrix4x4);
         matrix.SetTRS(drawPos, Quaternion.identity, s);
         Graphics.DrawMesh(MeshPool.plane10, matrix, material, 0);
     }
     if (arrowTarget != null)
     {
         Quaternion rotation = Quaternion.AngleAxis((arrowTarget.TrueCenter() - DrawPos).AngleFlat(), Vector3.up);
         Vector3    drawPos2 = DrawPos;
         drawPos2.y -= 0.01f;
         drawPos2   += 0.6f * (rotation * Vector3.forward);
         Graphics.DrawMesh(MeshPool.plane05, drawPos2, rotation, InteractionArrowTex, 0);
     }
 }
Exemple #15
0
        public static bool SetupMoteBubble(MoteBubble __instance, Texture2D icon, Pawn target, Color?iconColor = null)
        {
            __instance.iconMat = MaterialPool.MatFrom(icon, ShaderDatabase.TransparentPostLight, Color.white);
            //__instance.iconMatPropertyBlock = new MaterialPropertyBlock();
            if (!allWorkerThreads.TryGetValue(Thread.CurrentThread, out ThreadInfo threadInfo))
            {
                __instance.iconMatPropertyBlock = new MaterialPropertyBlock();
            }
            else
            {
                Func <object[], object> FuncMaterialPropertyBlock = parameters => new MaterialPropertyBlock();
                threadInfo.safeFunctionRequest = new object[] { FuncMaterialPropertyBlock, new object[] { } };
                mainThreadWaitHandle.Set();
                threadInfo.eventWaitStart.WaitOne();
                __instance.iconMatPropertyBlock = (MaterialPropertyBlock)threadInfo.safeFunctionResult;
            }

            __instance.arrowTarget = target;
            if (!iconColor.HasValue)
            {
                return(false);
            }
            __instance.iconMatPropertyBlock.SetColor("_Color", iconColor.Value);
            return(false);
        }
Exemple #16
0
        public static List <Material> MatsFromTexturesInFolder(string dirPath)
        {
            string path = "Textures/" + dirPath;

            return((from Texture2D tex in Resources.LoadAll(path, typeof(Texture2D))
                    select MaterialPool.MatFrom(tex)).ToList <Material>());
        }
Exemple #17
0
 public void BeginListening(ThingIsRelevantFilter callback, Texture2D dragHighlightTex)
 {
     listening          = true;
     filterCallback     = callback;
     dragHighlightMat   = MaterialPool.MatFrom(dragHighlightTex, ShaderDatabase.MetaOverlay, Color.white);
     invokingDesignator = Find.MapUI.designatorManager.SelectedDesignator;
 }
        /// <summary>
        /// Display the scan range of built mobile mineral sonar and the max scan range at the tested position.
        /// Allow placement nearly anywhere.
        /// </summary>
        public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null)
        {
            IEnumerable <Building> mobileMineralSonarList = map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("MobileMineralSonar"));

            if (mobileMineralSonarList != null)
            {
                foreach (Building mobileMineralSonar in mobileMineralSonarList)
                {
                    (mobileMineralSonar as Building_MobileMineralSonar).DrawMaxScanRange();
                }
            }

            if (ResearchProjectDef.Named("ResearchMobileMineralSonarEnhancedScan").IsFinished)
            {
                Material  scanRange50       = MaterialPool.MatFrom("Effects/ScanRange50");
                Vector3   scanRangeScale50  = new Vector3(100f, 1f, 100f);
                Matrix4x4 scanRangeMatrix50 = default(Matrix4x4);
                // The 10f offset on Y axis is mandatory to be over the fog of war.
                scanRangeMatrix50.SetTRS(loc.ToVector3ShiftedWithAltitude(AltitudeLayer.Blueprint) + new Vector3(0f, 15f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale50);
                Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix50, scanRange50, 0);
            }
            else
            {
                Material  scanRange30       = MaterialPool.MatFrom("Effects/ScanRange30");
                Vector3   scanRangeScale30  = new Vector3(60f, 1f, 60f);
                Matrix4x4 scanRangeMatrix30 = default(Matrix4x4);
                // The 10f offset on Y axis is mandatory to be over the fog of war.
                scanRangeMatrix30.SetTRS(loc.ToVector3ShiftedWithAltitude(AltitudeLayer.Blueprint) + new Vector3(0f, 15f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale30);
                Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix30, scanRange30, 0);
            }

            return(true);
        }
        /// <summary>
        /// Display the scan range of built mobile mineral sonar and the max scan range (according to research level) at the tested position.
        /// </summary>
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            base.DrawGhost(def, center, rot, ghostCol, thing);

            IEnumerable <Building> mobileMineralSonarList = Find.CurrentMap.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("MobileMineralSonar"));

            if (mobileMineralSonarList != null)
            {
                foreach (Building mobileMineralSonar in mobileMineralSonarList)
                {
                    (mobileMineralSonar as Building_MobileMineralSonar).DrawMaxScanRange();
                }
            }

            if (ResearchProjectDef.Named("ResearchMobileMineralSonarEnhancedScan").IsFinished)
            {
                Material  scanRange50       = MaterialPool.MatFrom("Effects/ScanRange50");
                Vector3   scanRangeScale50  = new Vector3(100f, 1f, 100f);
                Matrix4x4 scanRangeMatrix50 = default(Matrix4x4);
                // The 10f offset on Y axis is mandatory to be over the fog of war.
                scanRangeMatrix50.SetTRS(center.ToVector3ShiftedWithAltitude(AltitudeLayer.Blueprint) + new Vector3(0f, 15f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale50);
                Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix50, scanRange50, 0);
            }
            else
            {
                Material  scanRange30       = MaterialPool.MatFrom("Effects/ScanRange30");
                Vector3   scanRangeScale30  = new Vector3(60f, 1f, 60f);
                Matrix4x4 scanRangeMatrix30 = default(Matrix4x4);
                // The 10f offset on Y axis is mandatory to be over the fog of war.
                scanRangeMatrix30.SetTRS(center.ToVector3ShiftedWithAltitude(AltitudeLayer.Blueprint) + new Vector3(0f, 15f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale30);
                Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix30, scanRange30, 0);
            }
        }
Exemple #20
0
 public override void Draw()
 {
     base.Draw();
     if (this.iconMat != null)
     {
         Vector3 drawPos = this.DrawPos;
         drawPos.y += 0.01f;
         float num = Graphic_Mote.CalculateMoteAlpha(this);
         if (num <= 0f)
         {
             return;
         }
         Color instanceColor = this.instanceColor;
         instanceColor.a *= num;
         Material material = this.iconMat;
         if (instanceColor != material.color)
         {
             material = MaterialPool.MatFrom((Texture2D)material.mainTexture, material.shader, instanceColor);
         }
         Vector3   s      = new Vector3(this.def.graphicData.drawSize.x * 0.64f, 1f, this.def.graphicData.drawSize.y * 0.64f);
         Matrix4x4 matrix = default(Matrix4x4);
         matrix.SetTRS(drawPos, Quaternion.identity, s);
         Graphics.DrawMesh(MeshPool.plane10, matrix, material, 0);
     }
     if (this.arrowTarget != null)
     {
         Vector3    a        = this.arrowTarget.TrueCenter();
         float      angle    = (a - this.DrawPos).AngleFlat();
         Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.up);
         Vector3    vector   = this.DrawPos;
         vector.y -= 0.01f;
         vector   += 0.6f * (rotation * Vector3.forward);
         Graphics.DrawMesh(MeshPool.plane05, vector, rotation, MoteBubble.InteractionArrowTex, 0);
     }
 }
Exemple #21
0
 void CreateGraphics()
 {
     for (int i = 0; i < textures.Count; i++)
     {
         materials.Add(MaterialPool.MatFrom(textures[i], ShaderDatabase.TransparentPostLight));
     }
 }
        // transfer data from extended ThingDef to local variables
        // (Not really neccessary, but easier for me)
        private void ReadXmlData()
        {
            ThingDef_TurretWeaponBase def2 = (ThingDef_TurretWeaponBase)def;

            usedTopMatType = def2.usedTopGraphic;

            // Load material only, when all three are not empty
            if (!(def2.TopMatShortPath.NullOrEmpty() ||
                  def2.TopMatMediumPath.NullOrEmpty() ||
                  def2.TopMatLongPath.NullOrEmpty())
                )
            {
                TopMatShortWeapon  = MaterialPool.MatFrom(def2.TopMatShortPath);
                TopMatMediumWeapon = MaterialPool.MatFrom(def2.TopMatMediumPath);
                TopMatLongWeapon   = MaterialPool.MatFrom(def2.TopMatLongPath);
            }

            priceShortMax  = def2.priceShortMax;
            priceMediumMax = def2.priceMediumMax;

            cooldownMultiplicator = def2.cooldownMultiplicator;
            cooldownAddition      = def2.cooldownAddition;

            cooldownResearchName          = def2.cooldownResearchName;
            cooldownResearchMultiplicator = def2.cooldownResearchMultiplicator;
            cooldownResearchAddition      = def2.cooldownResearchAddition;
        }
 public void InitMainTextures()
 {
     if (!loadedMaterials.TryGetValue(texPath, out var materials))
     {
         var mainTextures = LoadAllFiles(texPath).OrderBy(x => x).ToList();
         if (mainTextures.Count > 0)
         {
             cachedMaterials = new Material[mainTextures.Count];
             for (var i = 0; i < mainTextures.Count; i++)
             {
                 var shader = this.shaderType != null ? this.shaderType.Shader : ShaderDatabase.DefaultShader;
                 cachedMaterials[i] = MaterialPool.MatFrom(mainTextures[i], shader, color);
             }
         }
         else
         {
             Log.Error("Error loading materials by this path: " + texPath);
         }
         loadedMaterials[texPath] = cachedMaterials;
     }
     else
     {
         cachedMaterials = materials;
     }
 }
Exemple #24
0
        public override void DrawWornExtras()
        {
            // base.DrawWornExtras();

            if (this.ShouldDisplay)
            {
                // base.DrawWornExtras();

                float   num    = 0f;
                Vector3 vector = this.Wearer.Drawer.DrawPos;
                // vector.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn);
                Vector3 s = new Vector3(1f, 1f, 1f);
                if (this.Wearer.Rotation == Rot4.North)
                {
                    vector.y  = Altitudes.AltitudeFor(AltitudeLayer.Item);
                    vector.x -= 0.2f;
                    vector.z -= 0.2f;
                }
                else
                {
                    if (this.Wearer.Rotation == Rot4.South)
                    {
                        vector.y  = Altitudes.AltitudeFor(AltitudeLayer.Pawn);
                        vector.y += 0.033f;
                        vector.x += 0.2f;
                        vector.z -= 0.2f;
                    }
                    else
                    {
                        if (this.Wearer.Rotation == Rot4.East)
                        {
                            vector.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn);
                            vector.z = 0.2f;
                            num      = 90f;
                        }
                        else
                        {
                            if (this.Wearer.Rotation == Rot4.West)
                            {
                                vector.y  = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead);
                                vector.z -= 0.2f;
                                num       = 270f;
                            }
                        }
                    }
                }


                if (shieldMat == null)
                {
                    shieldMat = MaterialPool.MatFrom(def.graphicData.texPath);
                }

                shieldMat.color = Stuff.stuffProps.color;
                Matrix4x4 matrix = default(Matrix4x4);
                matrix.SetTRS(vector, Quaternion.AngleAxis(num, Vector3.up), s);
                Graphics.DrawMesh(MeshPool.plane10, matrix, shieldMat, 0);
            }
        }
Exemple #25
0
        private void RenderOutOfFuelOverlay(Thing t)
        {
            CompRefuelable compRefuelable = t.TryGetComp <CompRefuelable>();
            Material       mat            = MaterialPool.MatFrom((compRefuelable != null) ? compRefuelable.Props.FuelIcon : ThingDefOf.Chemfuel.uiIcon, ShaderDatabase.MetaOverlay, Color.white);

            RenderPulsingOverlay(t, mat, 5, incrementOffset: false);
            RenderPulsingOverlay(t, OutOfFuelMat, 6);
        }
        private void RenderOutOfFuelOverlay(Thing t)
        {
            CompRefuelable compRefuelable = t.TryGetComp <CompRefuelable>();
            Material       mat            = MaterialPool.MatFrom((compRefuelable == null) ? ThingDefOf.Chemfuel.uiIcon : compRefuelable.Props.FuelIcon, ShaderDatabase.MetaOverlay, Color.white);

            this.RenderPulsingOverlay(t, mat, 5, false);
            this.RenderPulsingOverlay(t, OverlayDrawer.OutOfFuelMat, 6, true);
        }
Exemple #27
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();
            Table_Square.UI_change = ContentFinder <Texture2D> .Get("Clutter/Ui/UI_Change Button", true);

            this.cleanMat   = MaterialPool.MatFrom("Clutter/Tables/TableMidworldSquare", true);
            this.clutterMat = MaterialPool.MatFrom("Clutter/Tables/TableSpacerSquare", true);
        }
Exemple #28
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     if (Projectile_Sam.texture == null)
     {
         Projectile_Sam.texture = MaterialPool.MatFrom(this.def.graphicData.texPath);
     }
 }
 static Resources()
 {
     for (int i = 0; i < PlanMatColor.Length; i++)
     {
         Color c = new Color(0, 0, i);
         PlanMatColor[i] = MaterialPool.MatFrom("UI/PlanBase" + i, ShaderDatabase.MetaOverlay, c);
     }
 }
Exemple #30
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            base.DrawGhost(def, center, rot, ghostCol, thing);
            var pos = center.ToVector3Shifted();

            pos.y = AltitudeLayer.BuildingOnTop.AltitudeFor();
            Graphics.DrawMesh(MeshPool.plane10, pos, rot.AsQuat, MaterialPool.MatFrom(RS.Arrow), 0);
        }