/// <summary> /// Called after this Registry Entry has been registered to its Registry. You should never call this yourself. /// </summary> public override void PostRegister() { if (Entity != null) { GadgetCoreAPI.AddCustomResource("e/" + Entity.name, Entity); } }
/// <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 (Entity != null) { GadgetCoreAPI.AddCustomResource(ResourcePath = "e/" + Entity.name, Entity); } }
/// <summary> /// Called after this Registry Entry has been registered to its Registry. You should never call this yourself. /// </summary> protected internal override void PostRegister() { base.PostRegister(); if (VariantMats == null) { VariantMats = new Material[VariantTexes.Length]; for (int i = 0; i < VariantMats.Length; i++) { VariantMats[i] = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = VariantTexes[i] }; GadgetCoreAPI.AddCustomResource("r/r" + ID + "v" + i, VariantMats[i]); } } else { VariantTexes = new Texture[VariantMats.Length]; for (int i = 0; i < VariantTexes.Length; i++) { VariantTexes[i] = VariantMats[i].mainTexture; GadgetCoreAPI.AddCustomResource("r/r" + ID + "v" + i, VariantMats[i]); } } }
/// <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 (FlagMat == null) { FlagMat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = FlagTex }; FlagMat.SetFloat("_Cutoff", 0.5f); } else { FlagTex = FlagMat.mainTexture; } GadgetCoreAPI.AddCustomResource("flag/flag" + GetID(), FlagMat); if (InvIconMat == null) { InvIconMat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = InvIconTex }; InvIconMat.SetFloat("_Cutoff", 0.5f); } else { InvIconTex = InvIconMat.mainTexture; } }
/// <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> protected internal override void PostRegister() { if (Mat == null) { Mat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = Tex }; } else { Tex = Mat.mainTexture; } GadgetCoreAPI.AddCustomResource("cc/cc" + ID, Mat); }
/// <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); } }
/// <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 (GetEntryType() != PlanetType.SPECIAL || EntranceMat != null || EntranceTex != null) { if (EntranceMat == null) { EntranceMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = EntranceTex }; } else { EntranceTex = EntranceMat.mainTexture; } GadgetCoreAPI.AddCustomResource("z/entrance" + ID, EntranceMat); } if (GetEntryType() != PlanetType.SPECIAL || ZoneMat != null || ZoneTex != null) { if (ZoneMat == null) { ZoneMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = ZoneTex }; } else { ZoneTex = ZoneMat.mainTexture; } GadgetCoreAPI.AddCustomResource("z/z" + ID, ZoneMat); } if (GetEntryType() != PlanetType.SPECIAL || MidChunk0Mat != null || MidChunk0Tex != null) { if (MidChunk0Mat == null) { MidChunk0Mat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = MidChunk0Tex }; } else { MidChunk0Tex = MidChunk0Mat.mainTexture; } GadgetCoreAPI.AddCustomResource("z/midChunk0b" + ID, MidChunk0Mat); } if (GetEntryType() != PlanetType.SPECIAL || MidChunk1Mat != null || MidChunk1Tex != null) { if (MidChunk1Mat == null) { MidChunk1Mat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = MidChunk1Tex }; } else { MidChunk1Tex = MidChunk1Mat.mainTexture; } GadgetCoreAPI.AddCustomResource("z/midChunk1b" + ID, MidChunk1Mat); } if (GetEntryType() != PlanetType.SPECIAL || SideHMat != null || SideHTex != null) { if (SideHMat == null) { SideHMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = SideHTex }; } else { SideHTex = SideHMat.mainTexture; } GadgetCoreAPI.AddCustomResource("side/sideH" + ID, SideHMat); } if (GetEntryType() != PlanetType.SPECIAL || SideVMat != null || SideVTex != null) { if (SideVMat == null) { SideVMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = SideVTex }; } else { SideVTex = SideVMat.mainTexture; } GadgetCoreAPI.AddCustomResource("side/sideV" + ID, SideVMat); } if (GetEntryType() != PlanetType.SPECIAL || PortalSignMat != null || PortalSignTex != null) { if (PortalSignMat == null) { PortalSignMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = PortalSignTex }; } else { PortalSignTex = PortalSignMat.mainTexture; } GadgetCoreAPI.AddCustomResource("sign/sign" + ID, PortalSignMat); } if (GetEntryType() != PlanetType.SPECIAL || SelectorButtonMat != null || SelectorButtonTex != null) { if (SelectorButtonMat == null) { SelectorButtonMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = SelectorButtonTex }; } else { SelectorButtonTex = SelectorButtonMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/planetIcon" + ID, SelectorButtonMat); } if (GetEntryType() != PlanetType.SPECIAL || SelectorIconMat != null || SelectorIconTex != null) { if (SelectorIconMat == null) { SelectorIconMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = SelectorIconTex }; } else { SelectorIconTex = SelectorIconMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/planet" + ID, SelectorIconMat); } if (GetEntryType() != PlanetType.SPECIAL || BackgroundParallaxMat != null || BackgroundParallaxTex != null) { if (BackgroundParallaxMat == null) { BackgroundParallaxMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = BackgroundParallaxTex }; } else { BackgroundParallaxTex = BackgroundParallaxMat.mainTexture; } GadgetCoreAPI.AddCustomResource("par/parallax" + ID, BackgroundParallaxMat); } if (GetEntryType() != PlanetType.SPECIAL || BackgroundImageMats != null || BackgroundImageTexes != null) { if (BackgroundImageMats == null) { BackgroundImageMats = BackgroundImageTexes?.Select(x => new Material(Shader.Find("Unlit/Transparent")) { mainTexture = x }).ToArray(); } else { BackgroundImageTexes = BackgroundImageMats.Select(x => x.mainTexture).ToArray(); } for (int i = 0; i < BackgroundImageMats.Length; i++) { GadgetCoreAPI.AddCustomResource("bg/b" + ID + "bg" + i, BackgroundImageMats[i]); } } if (BackgroundMusic != null) { GadgetCoreAPI.AddCustomResource("Au/biome" + ID, BackgroundMusic); } for (int i = 0; i < WeightedExitPortalIDs.Count; i++) { if (WeightedExitPortalIDs[i].Item1 == -1) { WeightedExitPortalIDs[i] = Tuple.Create(ID, WeightedExitPortalIDs[i].Item2); } } }
/// <summary> /// Called after this Registry Entry has been registered to its Registry. You should never call this yourself. /// </summary> protected internal override void PostRegister() { base.PostRegister(); if (MenuMat == null) { MenuMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = MenuTex }; } else { MenuTex = MenuMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/craftMenu" + ID, MenuMat); if (ProgressBarMat == null) { ProgressBarMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = ProgressBarTex }; } else { ProgressBarTex = ProgressBarMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/craftBar" + ID, ProgressBarMat); if (ButtonInactiveMat == null) { ButtonInactiveMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = ButtonInactiveTex }; } else { ButtonInactiveTex = ButtonInactiveMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/craftButtonInactive" + ID, ButtonInactiveMat); if (ButtonActiveMat == null) { ButtonActiveMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = ButtonActiveTex }; } else { ButtonActiveTex = ButtonActiveMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/craftButtonActive" + ID, ButtonActiveMat); if (ButtonSelectMat == null) { ButtonSelectMat = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = ButtonSelectTex }; } else { ButtonSelectTex = ButtonSelectMat.mainTexture; } GadgetCoreAPI.AddCustomResource("mat/craftButtonSelect" + ID, ButtonSelectMat); }
/// <summary> /// Called after this Registry Entry has been registered to its Registry. You should never call this yourself. /// </summary> protected internal override void PostRegister() { base.PostRegister(); GadgetCoreAPI.AddCustomResource("aug/aug" + ID, Mat); }
/// <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) { Mat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = Tex }; Mat.SetFloat("_Cutoff", 0.5f); } else { Tex = Mat.mainTexture; } if (FlyHeadTex != null || FlyHeadMat != null) { if (FlyHeadMat == null) { FlyHeadMat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = FlyHeadTex }; FlyHeadMat.SetFloat("_Cutoff", 0.5f); } else { FlyHeadTex = FlyHeadMat.mainTexture; } } if (FlyWingTex != null || FlyWingMat != null) { if (FlyWingMat == null) { FlyWingMat = new Material(Shader.Find("Unlit/Transparent Cutout")) { mainTexture = FlyWingTex }; FlyWingMat.SetFloat("_Cutoff", 0.5f); } else { FlyWingTex = FlyWingMat.mainTexture; } } string name; switch (Type) { case ObjectType.ORE: name = "ore"; break; case ObjectType.TREE: name = "tree"; break; case ObjectType.PLANT: name = "plant"; break; case ObjectType.BUGSPOT: name = "bugspot"; break; default: name = "object"; break; } Object = UnityEngine.Object.Instantiate((GameObject)Resources.Load("obj/" + (name != "object" && FlyHeadMat == null && FlyWingMat == null ? name : "bugspot") + "0")); Object.name = name; ObjectScript script = Object.GetComponent <ObjectScript>(); script.id = GetID(); script.b.GetComponent <MeshRenderer>().material = Mat; script.GetComponent <BoxCollider>().center += (Vector3)ColliderOffset; if (script.b.transform.childCount > 0) { Transform fly = script.b.transform.GetChild(0).GetChild(0); if (fly.name == "fly") { foreach (Transform child in fly) { if (child.name == "Plane") { if (FlyHeadMat != null) { child.GetComponent <MeshRenderer>().material = FlyHeadMat; } } else if (child.name.StartsWith("Plane")) { if (FlyHeadMat != null) { child.GetComponent <MeshRenderer>().material = FlyWingMat; } } } } } GadgetCoreAPI.AddCustomResource(ResourcePath = "obj/" + name + ID, Object); }