mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
groups on details
This commit is contained in:
parent
8ce864812e
commit
bf6745d351
30
NewHorizons/Builder/General/GroupBuilder.cs
Normal file
30
NewHorizons/Builder/General/GroupBuilder.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Builder.General;
|
||||
|
||||
public static class GroupBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// puts groups on objects.
|
||||
/// run this before the gameobject is active.
|
||||
/// </summary>
|
||||
public static void Make(GameObject go, Sector sector)
|
||||
{
|
||||
Logger.LogVerbose($"putting groups on {go} (linked to {sector})");
|
||||
if (!sector)
|
||||
{
|
||||
Logger.LogWarning("tried to put groups on a null sector");
|
||||
return;
|
||||
}
|
||||
if (go.activeInHierarchy)
|
||||
{
|
||||
Logger.LogWarning("tried to put groups on an active gameobject");
|
||||
return;
|
||||
}
|
||||
|
||||
go.GetAddComponent<SectorCullGroup>()._sector = sector;
|
||||
go.GetAddComponent<SectorCollisionGroup>()._sector = sector;
|
||||
go.GetAddComponent<SectorLightsCullGroup>()._sector = sector;
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using NewHorizons.Builder.General;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Handlers;
|
||||
@ -100,6 +101,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
prop.transform.localScale = detail.scale != 0 ? Vector3.one * detail.scale : prefab.transform.localScale;
|
||||
|
||||
if (!detail.keepLoaded) GroupBuilder.Make(prop, sector);
|
||||
prop.SetActive(true);
|
||||
|
||||
if (prop == null) return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user