fix case / field-ness for SandModule and VariableSizeModule

This commit is contained in:
JohnCorby 2022-05-24 10:59:38 -07:00
parent 73b03a3557
commit 297377e1f1
10 changed files with 39 additions and 39 deletions

View File

@ -147,12 +147,12 @@ namespace NewHorizons.Builder.Body
var funnelSizeController = funnelGO.AddComponent<FunnelController>(); var funnelSizeController = funnelGO.AddComponent<FunnelController>();
if (module.Curve != null) if (module.curve != null)
{ {
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in module.Curve) foreach (var pair in module.curve)
{ {
curve.AddKey(new Keyframe(pair.Time, pair.Value)); curve.AddKey(new Keyframe(pair.time, pair.value));
} }
funnelSizeController.scaleCurve = curve; funnelSizeController.scaleCurve = curve;
} }

View File

@ -12,12 +12,12 @@ namespace NewHorizons.Builder.Body
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, LavaModule module) public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, LavaModule module)
{ {
var heightScale = module.size; var heightScale = module.size;
if (module.Curve != null) if (module.curve != null)
{ {
var modifier = 1f; var modifier = 1f;
foreach (var pair in module.Curve) foreach (var pair in module.curve)
{ {
if (pair.Value < modifier) modifier = pair.Value; if (pair.value < modifier) modifier = pair.value;
} }
heightScale = Mathf.Max(0.1f, heightScale * modifier); heightScale = Mathf.Max(0.1f, heightScale * modifier);
} }
@ -54,13 +54,13 @@ namespace NewHorizons.Builder.Body
destructionVolume.GetComponent<SphereCollider>().radius = 1; destructionVolume.GetComponent<SphereCollider>().radius = 1;
destructionVolume.SetActive(true); destructionVolume.SetActive(true);
if (module.Curve != null) if (module.curve != null)
{ {
var levelController = moltenCore.AddComponent<SandLevelController>(); var levelController = moltenCore.AddComponent<SandLevelController>();
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in module.Curve) foreach (var pair in module.curve)
{ {
curve.AddKey(new Keyframe(pair.Time, module.size * pair.Value)); curve.AddKey(new Keyframe(pair.time, module.size * pair.value));
} }
levelController._scaleCurve = curve; levelController._scaleCurve = curve;
} }

View File

@ -73,7 +73,7 @@ namespace NewHorizons.Builder.Body
} }
if (body.Config.Lava != null) if (body.Config.Lava != null)
{ {
var sphere = AddColouredSphere(newProxy, body.Config.Lava.size, body.Config.Lava.Curve, Color.black); var sphere = AddColouredSphere(newProxy, body.Config.Lava.size, body.Config.Lava.curve, Color.black);
if (realSize < body.Config.Lava.size) realSize = body.Config.Lava.size; if (realSize < body.Config.Lava.size) realSize = body.Config.Lava.size;
var material = new Material(lavaMaterial); var material = new Material(lavaMaterial);
@ -83,14 +83,14 @@ namespace NewHorizons.Builder.Body
if (body.Config.Water != null) if (body.Config.Water != null)
{ {
var colour = body.Config.Water.tint?.ToColor() ?? Color.blue; var colour = body.Config.Water.tint?.ToColor() ?? Color.blue;
AddColouredSphere(newProxy, body.Config.Water.size, body.Config.Water.Curve, colour); AddColouredSphere(newProxy, body.Config.Water.size, body.Config.Water.curve, colour);
if (realSize < body.Config.Water.size) realSize = body.Config.Water.size; if (realSize < body.Config.Water.size) realSize = body.Config.Water.size;
} }
if (body.Config.Sand != null) if (body.Config.Sand != null)
{ {
var colour = body.Config.Sand.Tint?.ToColor() ?? Color.yellow; var colour = body.Config.Sand.tint?.ToColor() ?? Color.yellow;
AddColouredSphere(newProxy, body.Config.Sand.Size, body.Config.Sand.Curve, colour); AddColouredSphere(newProxy, body.Config.Sand.size, body.Config.Sand.curve, colour);
if (realSize < body.Config.Sand.Size) realSize = body.Config.Sand.Size; if (realSize < body.Config.Sand.size) realSize = body.Config.Sand.size;
} }
// Could improve this to actually use the proper renders and materials // Could improve this to actually use the proper renders and materials
if (body.Config.Singularity != null) if (body.Config.Singularity != null)
@ -168,7 +168,7 @@ namespace NewHorizons.Builder.Body
var animCurve = new AnimationCurve(); var animCurve = new AnimationCurve();
foreach (var pair in curve) foreach (var pair in curve)
{ {
animCurve.AddKey(new Keyframe(pair.Time, pair.Value)); animCurve.AddKey(new Keyframe(pair.time, pair.value));
} }
sizeController.scaleCurve = animCurve; sizeController.scaleCurve = animCurve;
sizeController.size = size; sizeController.size = size;

View File

@ -123,13 +123,13 @@ namespace NewHorizons.Builder.Body
rot._localAxis = Vector3.down; rot._localAxis = Vector3.down;
} }
if (ring.Curve != null) if (ring.curve != null)
{ {
var levelController = ringGO.AddComponent<SizeController>(); var levelController = ringGO.AddComponent<SizeController>();
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in ring.Curve) foreach (var pair in ring.curve)
{ {
curve.AddKey(new Keyframe(pair.Time, pair.Value)); curve.AddKey(new Keyframe(pair.time, pair.value));
} }
levelController.scaleCurve = curve; levelController.scaleCurve = curve;
} }

View File

@ -12,7 +12,7 @@ namespace NewHorizons.Builder.Body
sandGO.SetActive(false); sandGO.SetActive(false);
var sandSphere = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/SandSphere"), sandGO.transform); var sandSphere = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/SandSphere"), sandGO.transform);
if (module.Tint != null) if (module.tint != null)
{ {
var oldMR = sandSphere.GetComponent<TessellatedSphereRenderer>(); var oldMR = sandSphere.GetComponent<TessellatedSphereRenderer>();
var sandMaterials = oldMR.sharedMaterials; var sandMaterials = oldMR.sharedMaterials;
@ -24,8 +24,8 @@ namespace NewHorizons.Builder.Body
new Material(sandMaterials[1]) new Material(sandMaterials[1])
}; };
GameObject.Destroy(oldMR); GameObject.Destroy(oldMR);
sandMR.sharedMaterials[0].color = module.Tint.ToColor(); sandMR.sharedMaterials[0].color = module.tint.ToColor();
sandMR.sharedMaterials[1].color = module.Tint.ToColor(); sandMR.sharedMaterials[1].color = module.tint.ToColor();
} }
var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform); var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform);
@ -40,20 +40,20 @@ namespace NewHorizons.Builder.Body
sandSphere.AddComponent<ChildColliderSettings>(); sandSphere.AddComponent<ChildColliderSettings>();
if (module.Curve != null) if (module.curve != null)
{ {
var levelController = sandGO.AddComponent<SandLevelController>(); var levelController = sandGO.AddComponent<SandLevelController>();
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in module.Curve) foreach (var pair in module.curve)
{ {
curve.AddKey(new Keyframe(pair.Time, 2f * module.Size * pair.Value)); curve.AddKey(new Keyframe(pair.time, 2f * module.size * pair.value));
} }
levelController._scaleCurve = curve; levelController._scaleCurve = curve;
} }
sandGO.transform.parent = sector?.transform ?? planetGO.transform; sandGO.transform.parent = sector?.transform ?? planetGO.transform;
sandGO.transform.position = planetGO.transform.position; sandGO.transform.position = planetGO.transform.position;
sandGO.transform.localScale = Vector3.one * module.Size * 2f; sandGO.transform.localScale = Vector3.one * module.size * 2f;
sandGO.SetActive(true); sandGO.SetActive(true);
} }

View File

@ -122,7 +122,7 @@ namespace NewHorizons.Builder.Body
starGO.SetActive(false); starGO.SetActive(false);
var controller = starGO.AddComponent<StarEvolutionController>(); var controller = starGO.AddComponent<StarEvolutionController>();
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve(); if (starModule.curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
controller.size = starModule.size; controller.size = starModule.size;
controller.atmosphere = sunAtmosphere; controller.atmosphere = sunAtmosphere;
controller.supernova = supernova; controller.supernova = supernova;
@ -151,7 +151,7 @@ namespace NewHorizons.Builder.Body
starGO.SetActive(false); starGO.SetActive(false);
var controller = starGO.AddComponent<StarEvolutionController>(); var controller = starGO.AddComponent<StarEvolutionController>();
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve(); if (starModule.curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
controller.size = starModule.size; controller.size = starModule.size;
controller.supernova = supernova; controller.supernova = supernova;
controller.StartColour = starModule.tint; controller.StartColour = starModule.tint;

View File

@ -90,13 +90,13 @@ namespace NewHorizons.Builder.Body
fogGO.GetComponent<MeshRenderer>().material.color = adjustedColour; fogGO.GetComponent<MeshRenderer>().material.color = adjustedColour;
} }
if (module.Curve != null) if (module.curve != null)
{ {
var sizeController = waterGO.AddComponent<WaterSizeController>(); var sizeController = waterGO.AddComponent<WaterSizeController>();
var curve = new AnimationCurve(); var curve = new AnimationCurve();
foreach (var pair in module.Curve) foreach (var pair in module.curve)
{ {
curve.AddKey(new Keyframe(pair.Time, pair.Value)); curve.AddKey(new Keyframe(pair.time, pair.value));
} }
sizeController.scaleCurve = curve; sizeController.scaleCurve = curve;
sizeController.oceanFogMaterial = fogGO.GetComponent<MeshRenderer>().material; sizeController.oceanFogMaterial = fogGO.GetComponent<MeshRenderer>().material;

View File

@ -543,7 +543,7 @@ namespace NewHorizons.Builder.ShipLog
var lavaColor = body.Config.Lava?.tint; var lavaColor = body.Config.Lava?.tint;
if (lavaColor != null) return lavaColor.ToColor(); if (lavaColor != null) return lavaColor.ToColor();
var sandColor = body.Config.Sand?.Tint; var sandColor = body.Config.Sand?.tint;
if (sandColor != null) return sandColor.ToColor(); if (sandColor != null) return sandColor.ToColor();
} }
catch (Exception) catch (Exception)

View File

@ -7,11 +7,11 @@ namespace NewHorizons.External.Modules.VariableSize
/// <summary> /// <summary>
/// Size of the sand /// Size of the sand
/// </summary> /// </summary>
public float Size { get; set; } public float size;
/// <summary> /// <summary>
/// Tint of the sand /// Tint of the sand
/// </summary> /// </summary>
public MColor Tint { get; set; } public MColor tint;
} }
} }

View File

@ -9,14 +9,14 @@ namespace NewHorizons.External.Modules.VariableSize
/// <summary> /// <summary>
/// Scale this module over time /// Scale this module over time
/// </summary> /// </summary>
public TimeValuePair[] Curve { get; set; } public TimeValuePair[] curve;
public AnimationCurve GetAnimationCurve(float size = 1f) public AnimationCurve GetAnimationCurve(float size = 1f)
{ {
var curve = new AnimationCurve(); var curve = new AnimationCurve();
if (Curve != null) if (this.curve != null)
foreach (var pair in Curve) foreach (var pair in this.curve)
curve.AddKey(new Keyframe(pair.Time, size * pair.Value)); curve.AddKey(new Keyframe(pair.time, size * pair.value));
return curve; return curve;
} }
@ -26,12 +26,12 @@ namespace NewHorizons.External.Modules.VariableSize
/// <summary> /// <summary>
/// A specific point in time /// A specific point in time
/// </summary> /// </summary>
public float Time { get; set; } public float time;
/// <summary> /// <summary>
/// The value for this point in time /// The value for this point in time
/// </summary> /// </summary>
public float Value { get; set; } public float value;
} }
} }
} }