Base prop info

That only has the parent path and rename
This commit is contained in:
Noah Pilarski 2024-06-04 05:55:46 -04:00
parent 6a3473d291
commit 5a354e4bee
2 changed files with 18 additions and 14 deletions

View File

@ -24,7 +24,7 @@ namespace NewHorizons.Builder.Props
// If a prop has set its parentPath and the parent cannot be found, add it to the next pass and try again later // If a prop has set its parentPath and the parent cannot be found, add it to the next pass and try again later
var nextPass = new List<Action>(); var nextPass = new List<Action>();
void MakeGeneralProp<T>(GameObject go, T prop, Action<T> builder) where T : GeneralPointPropInfo void MakeGeneralProp<T>(GameObject go, T prop, Action<T> builder) where T : BasePropInfo
{ {
try try
{ {
@ -43,7 +43,7 @@ namespace NewHorizons.Builder.Props
} }
} }
void MakeGeneralProps<T>(GameObject go, IEnumerable<T> props, Action<T> builder) where T : GeneralPointPropInfo void MakeGeneralProps<T>(GameObject go, IEnumerable<T> props, Action<T> builder) where T : BasePropInfo
{ {
if (props != null) if (props != null)
{ {
@ -167,7 +167,7 @@ namespace NewHorizons.Builder.Props
} }
} }
private static bool DoesParentExist(GameObject go, GeneralPointPropInfo prop) private static bool DoesParentExist(GameObject go, BasePropInfo prop)
{ {
if (string.IsNullOrEmpty(prop.parentPath)) if (string.IsNullOrEmpty(prop.parentPath))
{ {

View File

@ -5,27 +5,31 @@ using Newtonsoft.Json;
namespace NewHorizons.External.Modules namespace NewHorizons.External.Modules
{ {
[JsonObject] [JsonObject]
public abstract class GeneralPointPropInfo public abstract class BasePropInfo
{
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]
public abstract class GeneralPointPropInfo : BasePropInfo
{ {
/// <summary> /// <summary>
/// Position of the object /// Position of the object
/// </summary> /// </summary>
public MVector3 position; public MVector3 position;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary> /// <summary>
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object. /// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary> /// </summary>
public bool isRelativeToParent; public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
} }
[JsonObject] [JsonObject]