/// <summary> /// Called after this Registry Entry has been registered to its Registry. You should never call this yourself. /// </summary> protected internal override void PostRegister() { if (Mat == null && Tex != null) { Mat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = Tex }; } else if (Mat != null) { Tex = Mat.mainTexture as Texture2D; } if (Type == TileType.SOLID || Type == TileType.WALL) { if (Tex != null) { Sprite = GadgetCoreAPI.AddTextureToSheet(Tex); } } if (Mat != null) { GadgetCoreAPI.AddCustomResource("construct/c" + ID, Mat); } if (Prop != null) { if (Type == TileType.INTERACTIVE) { Prop.layer = 12; GadgetCoreAPI.AddCustomResource("npc/npc" + ID, Prop); if (Mat != null) { if (Item != null && Item.ID > 0) { GadgetCoreAPI.AddCustomResource("mat/por/portrait" + ID, Mat); } else { Material portraitMat = new Material(Mat.shader); portraitMat.CopyPropertiesFromMaterial(Mat); portraitMat.mainTextureScale = new Vector2(0.5f, 1); GadgetCoreAPI.AddCustomResource("mat/por/portrait" + ID, portraitMat); } } } else { GadgetCoreAPI.AddCustomResource("prop/" + ID, Prop); } } if (Item != null && Item.ID > 0) { Item.SetTile(this); } }
/// <summary> /// Called after this Registry Entry has been registered to its Registry. You should never call this yourself. /// </summary> public override void PostRegister() { if (Mat == null && Tex != null) { Mat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = Tex }; } else if (Mat != null) { Tex = Mat.mainTexture as Texture2D; } if (Type == TileType.SOLID || Type == TileType.WALL) { if (Tex != null) { Sprite = GadgetCoreAPI.AddTextureToSheet(Tex); } } if (Mat != null) { GadgetCoreAPI.AddCustomResource("construct/c" + ID, Mat); } if (Prop != null) { if (Type == TileType.INTERACTIVE) { Prop.layer = 12; GadgetCoreAPI.AddCustomResource("npc/npc" + ID, Prop); } else { GadgetCoreAPI.AddCustomResource("prop/" + ID, Prop); } } if (Item != null && Item.ID > 0) { Item.SetTile(this); } }