mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Use GeneralPropBuilder for singularities
This commit is contained in:
parent
3ca6d9a3db
commit
049bb5ba33
@ -10,6 +10,7 @@ using NewHorizons.Components.SizeControllers;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Color = UnityEngine.Color;
|
using Color = UnityEngine.Color;
|
||||||
using NewHorizons.Components.Volumes;
|
using NewHorizons.Components.Volumes;
|
||||||
|
using NewHorizons.Builder.Props;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
@ -139,26 +140,16 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
// polarity true = black, false = white
|
// polarity true = black, false = white
|
||||||
|
|
||||||
var singularity = new GameObject(!string.IsNullOrEmpty(rename) ? rename : (polarity ? "BlackHole" : "WhiteHole"));
|
var info = new SingularityModule
|
||||||
singularity.transform.parent = sector?.transform ?? planetGO.transform;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(parentPath))
|
|
||||||
{
|
{
|
||||||
var newParent = planetGO.transform.Find(parentPath);
|
position = position,
|
||||||
if (newParent != null)
|
rotation = rotation,
|
||||||
{
|
isRelativeToParent = isRelativeToParent,
|
||||||
singularity.transform.parent = newParent;
|
parentPath = parentPath,
|
||||||
}
|
rename = rename,
|
||||||
else
|
};
|
||||||
{
|
|
||||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{parentPath}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isRelativeToParent)
|
var singularity = GeneralPropBuilder.MakeNew(polarity ? "BlackHole" : "WhiteHole", planetGO, sector, info);
|
||||||
singularity.transform.localPosition = position;
|
|
||||||
else
|
|
||||||
singularity.transform.position = planetGO.transform.TransformPoint(position);
|
|
||||||
|
|
||||||
var singularityRenderer = MakeSingularityGraphics(singularity, polarity, horizon, distort, renderQueue);
|
var singularityRenderer = MakeSingularityGraphics(singularity, polarity, horizon, distort, renderQueue);
|
||||||
|
|
||||||
@ -273,12 +264,6 @@ namespace NewHorizons.Builder.Body
|
|||||||
whiteHoleFluidVolume.enabled = true;
|
whiteHoleFluidVolume.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rot = Quaternion.Euler(rotation);
|
|
||||||
if (isRelativeToParent)
|
|
||||||
singularity.transform.localRotation = rot;
|
|
||||||
else
|
|
||||||
singularity.transform.rotation = planetGO.transform.TransformRotation(rot);
|
|
||||||
|
|
||||||
singularity.SetActive(true);
|
singularity.SetActive(true);
|
||||||
return singularity;
|
return singularity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace NewHorizons.External.Modules.VariableSize
|
namespace NewHorizons.External.Modules.VariableSize
|
||||||
{
|
{
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class SingularityModule : VariableSizeModule
|
public class SingularityModule : PropModule.PositionedAndRotatedPropInfo
|
||||||
{
|
{
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum SingularityType
|
public enum SingularityType
|
||||||
@ -19,6 +19,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
[EnumMember(Value = @"whiteHole")] WhiteHole = 1
|
[EnumMember(Value = @"whiteHole")] WhiteHole = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Scale this object over time
|
||||||
|
/// </summary>
|
||||||
|
public TimeValuePair[] curve;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The uniqueID of the white hole or black hole that is paired to this one. If you don't set a value, entering will kill
|
/// The uniqueID of the white hole or black hole that is paired to this one. If you don't set a value, entering will kill
|
||||||
/// the player
|
/// the player
|
||||||
@ -30,16 +35,6 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string uniqueID;
|
public string uniqueID;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Position of the singularity
|
|
||||||
/// </summary>
|
|
||||||
public MVector3 position;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Rotation of the singularity. Determines the direction you come out of a white hole
|
|
||||||
/// </summary>
|
|
||||||
public MVector3 rotation;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Radius of the singularity. Note that this isn't the same as the event horizon, but includes the entire volume that
|
/// Radius of the singularity. Note that this isn't the same as the event horizon, but includes the entire volume that
|
||||||
/// has warped effects in it.
|
/// has warped effects in it.
|
||||||
@ -75,20 +70,5 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
/// Optional override for the render queue. If the singularity is rendering oddly, increasing this to 3000 can help
|
/// Optional override for the render queue. If the singularity is rendering oddly, increasing this to 3000 can help
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Range(2501f, 3500f)] public int renderQueueOverride = 2985;
|
[Range(2501f, 3500f)] public int renderQueueOverride = 2985;
|
||||||
|
|
||||||
/// <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>
|
|
||||||
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
|
||||||
/// </summary>
|
|
||||||
public bool isRelativeToParent;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// An optional rename of this object
|
|
||||||
/// </summary>
|
|
||||||
public string rename;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user