mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add parentPath to volumes
This commit is contained in:
parent
18d5755133
commit
57e26794d9
@ -41,7 +41,22 @@ namespace NewHorizons.Builder.ShipLog
|
||||
GameObject revealTriggerVolume = new GameObject("Reveal Volume (" + info.revealOn + ")");
|
||||
revealTriggerVolume.SetActive(false);
|
||||
revealTriggerVolume.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
go.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
revealTriggerVolume.transform.position = planetGO.transform.TransformPoint(info.position ?? Vector3.zero);
|
||||
|
||||
return revealTriggerVolume;
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,20 @@ namespace NewHorizons.Builder.Volumes
|
||||
go.SetActive(false);
|
||||
|
||||
go.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
go.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
go.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||
go.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
||||
|
||||
|
||||
@ -16,6 +16,20 @@ namespace NewHorizons.Builder.Volumes
|
||||
go.SetActive(false);
|
||||
|
||||
go.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
go.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
go.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||
go.layer = LayerMask.NameToLayer("BasicEffectVolume");
|
||||
|
||||
|
||||
@ -21,6 +21,20 @@ namespace NewHorizons.Builder.Volumes
|
||||
go.SetActive(false);
|
||||
|
||||
go.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
go.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
go.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||
go.layer = LayerMask.NameToLayer("BasicEffectVolume");
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.External.Modules;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Builder.Volumes
|
||||
{
|
||||
@ -12,6 +13,20 @@ namespace NewHorizons.Builder.Volumes
|
||||
go.SetActive(false);
|
||||
|
||||
go.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
go.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
go.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||
go.layer = LayerMask.NameToLayer("BasicEffectVolume");
|
||||
|
||||
|
||||
@ -66,6 +66,11 @@ namespace NewHorizons.External.Modules
|
||||
/// The radius of this volume.
|
||||
/// </summary>
|
||||
public float radius = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||
/// </summary>
|
||||
public string parentPath;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user