|
|
@@ -1,5 +1,6 @@
|
|
|
using UnityEngine;
|
|
|
using GadgetCore.API;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace ScrapYard
|
|
|
{
|
|
|
@@ -31,34 +32,79 @@ namespace ScrapYard
|
|
|
|
|
|
protected override void Initialize()
|
|
|
{
|
|
|
- Logger.Log("ScrapYard v" + Info.Mod.Version);
|
|
|
+ Logger.Log("Scrap Yard v" + Info.Mod.Version);
|
|
|
Core.logger = Logger;
|
|
|
|
|
|
- Texture2D texturePlanetIcon = GadgetCoreAPI.LoadTexture2D("planetScrapYard.png", false);
|
|
|
- Texture2D texturePlanetPrevIcon = GadgetCoreAPI.LoadTexture2D("planetScrapYardPrev.png", false);
|
|
|
- Texture2D texturePortalSign = GadgetCoreAPI.LoadTexture2D("signScrapYard.png", false);
|
|
|
- Texture2D textureBG= GadgetCoreAPI.LoadTexture2D("bgScrapYard.png", false);
|
|
|
- Texture2D textureParalex0 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg0.png", false);
|
|
|
- Texture2D textureParalex1 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg1.png", false);
|
|
|
- Texture2D textureParalex2 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg2.png", false);
|
|
|
- Texture2D textureParalex3 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg3.png", false);
|
|
|
+ Texture2D texturePlanetIcon = GadgetCoreAPI.LoadTexture2D("planetScrapYard.png");
|
|
|
+ Texture2D texturePlanetPrevIcon = GadgetCoreAPI.LoadTexture2D("planetScrapYardPrev.png");
|
|
|
+ Texture2D texturePortalSign = GadgetCoreAPI.LoadTexture2D("signScrapYard.png");
|
|
|
+ Texture2D textureBG = GadgetCoreAPI.LoadTexture2D("bgScrapYard.png");
|
|
|
+ Texture2D textureParalex = GadgetCoreAPI.LoadTexture2D("parallax.png");
|
|
|
+ Texture2D textureParalex0 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg0.png");
|
|
|
+ Texture2D textureParalex1 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg1.png");
|
|
|
+ Texture2D textureParalex2 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg2.png");
|
|
|
+ Texture2D textureParalex3 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg3.png");
|
|
|
|
|
|
- Texture2D textureEntrance = GadgetCoreAPI.LoadTexture2D("entranceScrapYard.png", false);
|
|
|
- Texture2D textureSmallSide = GadgetCoreAPI.LoadTexture2D("sideSmallScrapYard.png", false);
|
|
|
- Texture2D textureBigSide = GadgetCoreAPI.LoadTexture2D("sideBigScrapYard.png", false);
|
|
|
+ Texture2D textureEntrance = GadgetCoreAPI.LoadTexture2D("entranceScrapYard.png");
|
|
|
+ Texture2D textureSmallSide = GadgetCoreAPI.LoadTexture2D("sideSmallScrapYard.png");
|
|
|
+ Texture2D textureBigSide = GadgetCoreAPI.LoadTexture2D("sideBigScrapYard.png");
|
|
|
|
|
|
- Texture2D textureMid0 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk0.png", false);
|
|
|
- Texture2D textureMid1 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk1.png", false);
|
|
|
+ Texture2D textureMid0 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk0.png");
|
|
|
+ Texture2D textureMid1 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk1.png");
|
|
|
|
|
|
- PlanetInfo scrapYardPlanet = new PlanetInfo(PlanetType.NORMAL, "Scrap Yard", new GadgetCore.Util.Tuple<int, int>[] { new GadgetCore.Util.Tuple<int, int>(1, 100) });
|
|
|
+ PlanetInfo scrapYardPlanet = new PlanetInfo(PlanetType.SINGLE, "Scrap Yard", new GadgetCore.Util.Tuple<int, int>[] { new GadgetCore.Util.Tuple<int, int>(1, 100) });
|
|
|
scrapYardPlanet.SetPortalInfo(texturePortalSign, texturePlanetPrevIcon, texturePlanetIcon);
|
|
|
- scrapYardPlanet.SetBackgroundInfo(textureBG, textureParalex0, textureParalex1, textureParalex2, textureParalex3);
|
|
|
+ scrapYardPlanet.SetBackgroundInfo(textureParalex, textureParalex0, textureParalex1, textureParalex2, textureParalex3);
|
|
|
scrapYardPlanet.SetTerrainInfo(textureEntrance, textureBG, textureMid0, textureMid1, textureBigSide, textureSmallSide);
|
|
|
+
|
|
|
+ scrapYardPlanet.OnGenerateInsideTown += GenerateTown;
|
|
|
+ scrapYardPlanet.PortalUses = 300;
|
|
|
+
|
|
|
+ {
|
|
|
+ var scrapYardShopBuilding = Object.Instantiate((GameObject)Resources.Load("prop/2501"));
|
|
|
+ scrapYardShopBuilding.transform.localScale *= 8;
|
|
|
+ Texture2D texture = GadgetCoreAPI.LoadTexture2D("shopStand.png");
|
|
|
+ var renderer = scrapYardShopBuilding.GetComponentInChildren<Renderer>();
|
|
|
+ renderer.material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = texture
|
|
|
+ };
|
|
|
+ GadgetCoreAPI.AddCustomResource("prop/ScrapYard/scrapYardShopBuilding", scrapYardShopBuilding);
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ var scrapYardMerchant = Object.Instantiate((GameObject)Resources.Load("npc/perceval"));
|
|
|
+ Texture2D textureBody = GadgetCoreAPI.LoadTexture2D("merchantBody.png");
|
|
|
+ Texture2D textureHead = GadgetCoreAPI.LoadTexture2D("merchantHead.png");
|
|
|
+ var gameObjectBody = scrapYardMerchant.transform.Find("e").Find("perceval").FindChild("Plane_002");
|
|
|
+ var rendererBody = gameObjectBody.gameObject.GetComponentInChildren<Renderer>();
|
|
|
+ rendererBody.material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = textureBody
|
|
|
+ };
|
|
|
+ rendererBody.transform.position = new Vector3(0, 0, 0.1f);
|
|
|
+ var gameObjectHead = scrapYardMerchant.transform.Find("e").Find("perceval").FindChild("Plane");
|
|
|
+ var rendererHead = gameObjectHead.gameObject.GetComponentInChildren<Renderer>();
|
|
|
+ rendererHead.material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = textureHead
|
|
|
+ };
|
|
|
+ Component.DestroyImmediate(scrapYardMerchant.GetComponent<npcTurnScript>());
|
|
|
+ GadgetCoreAPI.AddCustomResource("prop/ScrapYard/scrapYardMerchant", scrapYardMerchant);
|
|
|
+ }
|
|
|
+
|
|
|
scrapYardPlanet.Register("Scrap Yard");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- //PlanetRegistry.SetVanillaExitPortalWeight(0, scrapYardPlanet.GetID(), 1000);
|
|
|
+ private static IEnumerable<GameObject> GenerateTown(Chunk chunk)
|
|
|
+ {
|
|
|
+ var list = new List<GameObject>();
|
|
|
+
|
|
|
+ list.Add((GameObject)Network.Instantiate(Resources.Load("prop/ScrapYard/scrapYardShopBuilding"), new Vector3(250f, -6f + 0.118f, 0.3f), Quaternion.identity, 0));
|
|
|
+ list.Add((GameObject)Network.Instantiate(Resources.Load("prop/ScrapYard/scrapYardMerchant"), new Vector3(255f, -6f - 0.118f * 12, 0.2f), Quaternion.identity, 0));
|
|
|
|
|
|
+ return list;
|
|
|
}
|
|
|
}
|
|
|
}
|