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>();
if (module.Curve != null)
if (module.curve != null)
{
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;
}

View File

@ -12,12 +12,12 @@ namespace NewHorizons.Builder.Body
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, LavaModule module)
{
var heightScale = module.size;
if (module.Curve != null)
if (module.curve != null)
{
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);
}
@ -54,13 +54,13 @@ namespace NewHorizons.Builder.Body
destructionVolume.GetComponent<SphereCollider>().radius = 1;
destructionVolume.SetActive(true);
if (module.Curve != null)
if (module.curve != null)
{
var levelController = moltenCore.AddComponent<SandLevelController>();
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;
}

View File

@ -73,7 +73,7 @@ namespace NewHorizons.Builder.Body
}
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;
var material = new Material(lavaMaterial);
@ -83,14 +83,14 @@ namespace NewHorizons.Builder.Body
if (body.Config.Water != null)
{
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 (body.Config.Sand != null)
{
var colour = body.Config.Sand.Tint?.ToColor() ?? Color.yellow;
AddColouredSphere(newProxy, body.Config.Sand.Size, body.Config.Sand.Curve, colour);
if (realSize < body.Config.Sand.Size) realSize = body.Config.Sand.Size;
var colour = body.Config.Sand.tint?.ToColor() ?? Color.yellow;
AddColouredSphere(newProxy, body.Config.Sand.size, body.Config.Sand.curve, colour);
if (realSize < body.Config.Sand.size) realSize = body.Config.Sand.size;
}
// Could improve this to actually use the proper renders and materials
if (body.Config.Singularity != null)
@ -168,7 +168,7 @@ namespace NewHorizons.Builder.Body
var animCurve = new AnimationCurve();
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.size = size;

View File

@ -123,13 +123,13 @@ namespace NewHorizons.Builder.Body
rot._localAxis = Vector3.down;
}
if (ring.Curve != null)
if (ring.curve != null)
{
var levelController = ringGO.AddComponent<SizeController>();
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;
}

View File

@ -12,7 +12,7 @@ namespace NewHorizons.Builder.Body
sandGO.SetActive(false);
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 sandMaterials = oldMR.sharedMaterials;
@ -24,8 +24,8 @@ namespace NewHorizons.Builder.Body
new Material(sandMaterials[1])
};
GameObject.Destroy(oldMR);
sandMR.sharedMaterials[0].color = module.Tint.ToColor();
sandMR.sharedMaterials[1].color = module.Tint.ToColor();
sandMR.sharedMaterials[0].color = module.tint.ToColor();
sandMR.sharedMaterials[1].color = module.tint.ToColor();
}
var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform);
@ -40,20 +40,20 @@ namespace NewHorizons.Builder.Body
sandSphere.AddComponent<ChildColliderSettings>();
if (module.Curve != null)
if (module.curve != null)
{
var levelController = sandGO.AddComponent<SandLevelController>();
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;
}
sandGO.transform.parent = sector?.transform ?? planetGO.transform;
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);
}

View File

@ -122,7 +122,7 @@ namespace NewHorizons.Builder.Body
starGO.SetActive(false);
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.atmosphere = sunAtmosphere;
controller.supernova = supernova;
@ -151,7 +151,7 @@ namespace NewHorizons.Builder.Body
starGO.SetActive(false);
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.supernova = supernova;
controller.StartColour = starModule.tint;

View File

@ -90,13 +90,13 @@ namespace NewHorizons.Builder.Body
fogGO.GetComponent<MeshRenderer>().material.color = adjustedColour;
}
if (module.Curve != null)
if (module.curve != null)
{
var sizeController = waterGO.AddComponent<WaterSizeController>();
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.oceanFogMaterial = fogGO.GetComponent<MeshRenderer>().material;

View File

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

View File

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

View File

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