Ejemplo n.º 1
0
 public new void Awake()
 {
     base.Awake();
     InvokeRepeating("UpdatePlanTotem", 3f, 3f);
     m_areaMarker          = GetComponentInChildren <CircleProjector>(true);
     m_activeMarker        = transform.Find("new/pivot").gameObject;
     m_model               = transform.Find("new/totem").GetComponent <MeshRenderer>();
     m_areaMarker.m_radius = radiusConfig.Value;
     m_chestBounds         = transform.Find("new/chest/privatechest").GetComponent <BoxCollider>().bounds;
     m_allPlanTotems.Add(this);
     HideMarker();
 }
Ejemplo n.º 2
0
        public static void CraftingStation_Start(ref float ___m_rangeBuild, ref GameObject ___m_areaMarker)
        {
            ___m_rangeBuild = Plugin.WorkbenchRadius.Value;

            if (___m_areaMarker != null)
            {
                CircleProjector proj = ___m_areaMarker.GetComponent <CircleProjector>();

                if (proj != null)
                {
                    proj.m_radius = ___m_rangeBuild;
                }
            }
        }
Ejemplo n.º 3
0
        public PlanTotemPrefab(AssetBundle planbuildBundle)
        {
            planTotemKitBash = KitBashManager.Instance.KitBash(planbuildBundle.LoadAsset <GameObject>("piece_plan_totem"), new KitBashConfig
            {
                FixReferences  = true,
                KitBashSources = new List <KitBashSourceConfig> {
                    new KitBashSourceConfig
                    {
                        name             = "totem",
                        targetParentPath = "new",
                        sourcePrefab     = "guard_stone",
                        sourcePath       = "new/default",
                        scale            = Vector3.one * 0.6f
                    },
                    new KitBashSourceConfig
                    {
                        name             = "chest",
                        targetParentPath = "new",
                        sourcePrefab     = "piece_chest_private",
                        sourcePath       = "New",
                        position         = new Vector3(0, 0, 0.591f),
                        scale            = Vector3.one * 0.9f,
                        rotation         = Quaternion.Euler(180f, 180f, 180f)
                    },
                    new KitBashSourceConfig
                    {
                        name             = "hammer",
                        targetParentPath = "new/pivot",
                        sourcePrefab     = "Hammer",
                        sourcePath       = "attach/hammer",
                        position         = new Vector3(0.07f, 1.9f, 0f),
                        rotation         = Quaternion.Euler(0f, 0f, 20f),
                        scale            = Vector3.one * 0.3f
                    }
                }
            });
            planTotemKitBash.KitBashApplied += () =>
            {
                GameObject connectionPrefab          = PrefabManager.Instance.GetPrefab("forge_ext1").GetComponent <StationExtension>().m_connectionPrefab;
                GameObject planBuildConnectionPrefab = PrefabManager.Instance.CreateClonedPrefab("vfx_PlanBuildConnection", connectionPrefab);

                GameObject planTotemPrefab = planTotemKitBash.Prefab;

                ShaderHelper.UpdateTextures(planTotemPrefab.transform.Find("new/pivot/hammer").gameObject, ShaderHelper.ShaderState.Supported);

                PlanTotem planTotem = planTotemPrefab.AddComponent <PlanTotem>();

                PlanTotem.m_connectionPrefab = planBuildConnectionPrefab;

                planTotem.m_open   = planTotemPrefab.transform.Find("new/chest/privatechesttop_open").gameObject;
                planTotem.m_closed = planTotemPrefab.transform.Find("new/chest/privatechesttop_closed").gameObject;
                planTotem.m_height = 2;
                planTotem.m_width  = 6;

                MeshRenderer meshRenderer = planTotemPrefab.transform.Find("new/totem").GetComponent <MeshRenderer>();
                meshRenderer.materials
                .Where(material => material.name.StartsWith("Guardstone_OdenGlow_mat"))
                .First()
                .SetColor("_EmissionColor", glowColorConfig.Value);

                CircleProjector circleProjector = planTotemPrefab.GetComponentInChildren <CircleProjector>(includeInactive: true);
                circleProjector.m_prefab = PrefabManager.Instance.GetPrefab("guard_stone").GetComponentInChildren <CircleProjector>().m_prefab;
                circleProjector.m_radius = PlanTotem.radiusConfig.Value;
            };

            CustomPiece planTotemPiece = new CustomPiece(planTotemKitBash.Prefab, new PieceConfig()
            {
                PieceTable   = "Hammer",
                Requirements = new RequirementConfig[]
                {
                    new RequirementConfig {
                        Item = "FineWood", Amount = 5, Recover = true
                    },
                    new RequirementConfig {
                        Item = "GreydwarfEye", Amount = 5, Recover = true
                    },
                    new RequirementConfig {
                        Item = "SurtlingCore", Recover = true
                    }
                }
            });

            PieceManager.Instance.AddPiece(planTotemPiece);
        }