Add optional parent path to signal info

This commit is contained in:
Noah Pilarski 2022-07-26 12:05:34 -04:00
parent c7985b9e08
commit 8a00627efd
2 changed files with 11 additions and 0 deletions

View File

@ -136,6 +136,12 @@ namespace NewHorizons.Builder.Props
var signalGO = new GameObject($"Signal_{info.name}");
signalGO.SetActive(false);
signalGO.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
{
signalGO.transform.parent = planetGO.transform.Find(info.parentPath);
}
signalGO.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
signalGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");

View File

@ -75,6 +75,11 @@ namespace NewHorizons.External.Modules
/// Radius of the sphere giving off the signal.
/// </summary>
[DefaultValue(1f)] public float sourceRadius = 1f;
/// <summary>
/// The relative path from the planet to the parent of this signal. Optional (will default to the root sector).
/// </summary>
public string parentPath;
}
}
}