Example #1
0
 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;
         }
     }
 }
Example #2
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;
         }
     }
 }
Example #3
0
 private void UpdateGraphics()
 {
     if (axlesComp.HasAxles())
     {
         string text = "Things/Pawn/" + def.defName + "/Wheel";
         graphic_Wheel_Single = new Graphic_Single();
         graphic_Wheel_Single =
             GraphicDatabase.Get <Graphic_Single>(text, def.graphic.Shader, def.graphic.drawSize,
                                                  def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     }
 }
        private void UpdateGraphics()
        {
            graphic = new Graphic_Single[arraySize];

            int    indexOf_frame       = def.graphicPathSingle.ToLower().LastIndexOf(graphicPathAdditionWoNumber);
            string graphicRealPathBase = def.graphicPathSingle.Remove(indexOf_frame);

            for (int i = 0; i < arraySize; i++)
            {
                string graphicRealPath = graphicRealPathBase + graphicPathAdditionWoNumber + (i + 1).ToString();

                Material mat = MaterialPool.MatFrom(graphicRealPath, def.shader);
                graphic[i] = new Graphic_Single(mat);
            }
        }
 private void UpdateGraphics()
 {
     if (axlesComp.HasAxles())
     {
         string text = "Things/Pawn/" + def.defName + "/Wheel";
         graphic_Wheel_Single = new Graphic_Single();
         graphic_Wheel_Single = GraphicDatabase.Get <Graphic_Single>(text, def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     }
     if (vehicleComp.ShowsStorage())
     {
         string text2 = string.Concat("Things/Pawn/", def.defName, "/", def.defName, "_FullStorage");
         graphic_FullStorage = new Graphic_Multi();
         graphic_FullStorage = GraphicDatabase.Get <Graphic_Multi>(text2, def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Multi;
     }
 }
Example #6
0
        // Unfortunately the method used to populate a Graphic_Collection does not actually put the graphics in order
        // based on their filename. It's pretty difficult to make an interesting animation where the order of the frames
        // doesn't matter, so we have to fix this ourselves.

        public override void Init(GraphicRequest req)
        {
            List <string> files = Directory.GetFiles(Path.Combine(ModUtilities.GetTexturePath(), req.path)).ToList();

            files.Sort((a, b) => a.CompareTo(b));

            subGraphics = new Graphic_Single[files.Count];
            path        = req.path;
            shader      = req.shader;
            color       = req.color;
            drawSize    = req.drawSize;

            int i = 0;

            foreach (string file in files)
            {
                string fileRelative = req.path + "/" + Path.GetFileNameWithoutExtension(file);
                subGraphics[i++] = GraphicDatabase.Get <Graphic_Single>(fileRelative, shader, drawSize, color);
            }
        }
        public void ChangeGraphic()
        {
            Vector2       sizeVector   = this.parent.Graphic.drawSize;
            Color         objectColour = this.parent.Graphic.color;
            ShaderTypeDef shaderUsed   = this.parent.def.graphicData.shaderType;

            if (this.parent.Faction != null && this.parent.Faction.IsPlayer)
            {
                if (this.parent.def.graphicData.graphicClass == typeof(Graphic_Multi))
                {
                    if (newGraphicPath == "")
                    {
                        newGraphicPath = Props.randomGraphics.RandomElement();
                        newGraphic     = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                    }
                    else
                    {
                        newGraphic = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                    }
                    Type      typ  = typeof(Thing);
                    FieldInfo type = typ.GetField("graphicInt", BindingFlags.Instance | BindingFlags.NonPublic);
                    type.SetValue(thingToGrab, newGraphic);
                }
                else if (this.parent.def.graphicData.graphicClass == typeof(Graphic_Single))
                {
                    if (newGraphicSinglePath == "")
                    {
                        newGraphicSinglePath = Props.randomGraphics.RandomElement();
                        newGraphicSingle     = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                    }
                    else
                    {
                        newGraphicSingle = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                    }
                    Type      typ  = typeof(Thing);
                    FieldInfo type = typ.GetField("graphicInt", BindingFlags.Instance | BindingFlags.NonPublic);
                    type.SetValue(thingToGrab, newGraphicSingle);
                }
            }
        }
Example #8
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.armedgfc = new Graphic_Single(MaterialPool.MatFrom("Things/Weapons/APM_disarmed", true));
 }
        public void ChangeGraphic()
        {
            try
            {
                Vector2       sizeVector   = parent.Graphic.drawSize;
                Color         objectColour = parent.Graphic.color;
                ShaderTypeDef shaderUsed   = parent.def.graphicData.shaderType;

                if (parent.Faction != null && parent.Faction.IsPlayer)
                {
                    if (parent.def.graphicData.graphicClass == typeof(Graphic_Multi))
                    {
                        if (!VFECore.VFEGlobal.settings.isRandomGraphic)
                        {
                            if (!reloading)
                            {
                                int newGraphicPathIndex = Props.randomGraphics.IndexOf(newGraphicPath);
                                if (newGraphicPathIndex + 1 > Props.randomGraphics.Count - 1)
                                {
                                    newGraphicPathIndex = 0;
                                }
                                else
                                {
                                    newGraphicPathIndex++;
                                }
                                newGraphicPath = Props.randomGraphics[newGraphicPathIndex];
                                newGraphic     = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                            }
                            else
                            {
                                if (newGraphicPath == "")
                                {
                                    newGraphicPath = Props.randomGraphics[0];
                                    newGraphic     = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                                }
                                else
                                {
                                    newGraphic = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                                }
                                reloading = false;
                            }
                        }
                        else if (newGraphicPath == "")
                        {
                            newGraphicPath = Props.randomGraphics.RandomElement();
                            newGraphic     = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                        }
                        else
                        {
                            newGraphic = (Graphic_Multi)GraphicDatabase.Get <Graphic_Multi>(newGraphicPath, shaderUsed.Shader, sizeVector, objectColour);
                        }
                        Type      typ  = typeof(Thing);
                        FieldInfo type = typ.GetField("graphicInt", BindingFlags.Instance | BindingFlags.NonPublic);
                        type.SetValue(thingToGrab, newGraphic);
                    }
                    else if (parent.def.graphicData.graphicClass == typeof(Graphic_Single))
                    {
                        if (!VFECore.VFEGlobal.settings.isRandomGraphic)
                        {
                            if (!reloading)
                            {
                                int newGraphicPathIndex = Props.randomGraphics.IndexOf(newGraphicSinglePath);
                                if (newGraphicPathIndex + 1 > Props.randomGraphics.Count - 1)
                                {
                                    newGraphicPathIndex = 0;
                                }
                                else
                                {
                                    newGraphicPathIndex++;
                                }
                                newGraphicSinglePath = Props.randomGraphics[newGraphicPathIndex];
                                newGraphicSingle     = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                            }
                            else
                            {
                                if (newGraphicSinglePath == "")
                                {
                                    newGraphicSinglePath = Props.randomGraphics[0];
                                    newGraphicSingle     = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                                }
                                else
                                {
                                    newGraphicSingle = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                                }
                                reloading = false;
                            }
                        }
                        else
                        if (newGraphicSinglePath == "")
                        {
                            newGraphicSinglePath = Props.randomGraphics.RandomElement();
                            newGraphicSingle     = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                        }
                        else
                        {
                            newGraphicSingle = (Graphic_Single)GraphicDatabase.Get <Graphic_Single>(newGraphicSinglePath, shaderUsed.Shader, sizeVector, objectColour);
                        }
                        Type      typ  = typeof(Thing);
                        FieldInfo type = typ.GetField("graphicInt", BindingFlags.Instance | BindingFlags.NonPublic);
                        type.SetValue(thingToGrab, newGraphicSingle);
                    }
                }
            }
            catch (Exception) { Log.Message("The variations mod has probably been added to a running save. Ignoring load error."); }
        }
Example #10
0
        // Unfortunately the method used to populate a Graphic_Collection does not actually put the graphics in order
        // based on their filename. It's pretty difficult to make an interesting animation where the order of the frames
        // doesn't matter, so we have to fix this ourselves.
        public override void Init(GraphicRequest req)
        {
            List<string> files = Directory.GetFiles(Path.Combine(ModUtilities.GetTexturePath(), req.path)).ToList();
            files.Sort((a, b) => a.CompareTo(b));

            subGraphics = new Graphic_Single[files.Count];
            path = req.path;
            //Shader = req.shader;
            color = req.color;
            drawSize = req.drawSize;

            int i = 0;
            foreach (string file in files)
            {
                string fileRelative = req.path + "/" + Path.GetFileNameWithoutExtension(file);
                subGraphics[i++] = GraphicDatabase.Get<Graphic_Single>(fileRelative, req.shader, drawSize, color);
            }
        }
Example #11
0
 private void UpdateGraphics()
 {
     graphic_Outside = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_Roof", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_WheelL = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_wheel", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_WheelR = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_wheel", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_Hetch = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_Hetch", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_HetchOpen = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_HetchOpen", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_BackDoor = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_BackDoor", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_BackDoorInside = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_BackDoorInside", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
     graphic_SideHole = GraphicDatabase.Get<Graphic_Single>("Things/Pawn/Vehicle/APC_SideHole", def.graphic.Shader, def.graphic.drawSize, def.graphic.color, def.graphic.colorTwo) as Graphic_Single;
 }