mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Move TimeValuePair to Utility, Ring no longer inherits from VariableSizeModule
Also migrated the old value for curve to scaleCurve.
This commit is contained in:
parent
3b55558daa
commit
8d78c49c64
@ -188,7 +188,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
newProxy.SetActive(true);
|
newProxy.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GameObject AddColouredSphere(GameObject rootObj, float size, VariableSizeModule.TimeValuePair[] curve, Color color)
|
private static GameObject AddColouredSphere(GameObject rootObj, float size, TimeValuePair[] curve, Color color)
|
||||||
{
|
{
|
||||||
GameObject sphereGO = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
GameObject sphereGO = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||||
sphereGO.transform.name = "ProxySphere";
|
sphereGO.transform.name = "ProxySphere";
|
||||||
@ -206,7 +206,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
return sphereGO;
|
return sphereGO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddSizeController(GameObject go, VariableSizeModule.TimeValuePair[] curve, float size)
|
private static void AddSizeController(GameObject go, TimeValuePair[] curve, float size)
|
||||||
{
|
{
|
||||||
var sizeController = go.AddComponent<SizeController>();
|
var sizeController = go.AddComponent<SizeController>();
|
||||||
sizeController.SetScaleCurve(curve);
|
sizeController.SetScaleCurve(curve);
|
||||||
|
|||||||
@ -7,7 +7,6 @@ using System.Collections.Generic;
|
|||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Body
|
namespace NewHorizons.Builder.Body
|
||||||
{
|
{
|
||||||
|
|||||||
@ -95,7 +95,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject MakeBlackHole(GameObject planetGO, Sector sector, Vector3 localPosition, float size,
|
public static GameObject MakeBlackHole(GameObject planetGO, Sector sector, Vector3 localPosition, float size,
|
||||||
bool hasDestructionVolume, string targetSolarSystem, VariableSizeModule.TimeValuePair[] curve, bool makeAudio = true)
|
bool hasDestructionVolume, string targetSolarSystem, TimeValuePair[] curve, bool makeAudio = true)
|
||||||
{
|
{
|
||||||
var blackHole = new GameObject("BlackHole");
|
var blackHole = new GameObject("BlackHole");
|
||||||
blackHole.SetActive(false);
|
blackHole.SetActive(false);
|
||||||
@ -181,7 +181,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject MakeWhiteHole(GameObject planetGO, Sector sector, OWRigidbody OWRB, Vector3 localPosition, float size,
|
public static GameObject MakeWhiteHole(GameObject planetGO, Sector sector, OWRigidbody OWRB, Vector3 localPosition, float size,
|
||||||
VariableSizeModule.TimeValuePair[] curve, bool makeZeroGVolume = true)
|
TimeValuePair[] curve, bool makeZeroGVolume = true)
|
||||||
{
|
{
|
||||||
var whiteHole = new GameObject("WhiteHole");
|
var whiteHole = new GameObject("WhiteHole");
|
||||||
whiteHole.SetActive(false);
|
whiteHole.SetActive(false);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components
|
||||||
@ -35,7 +36,7 @@ namespace NewHorizons.Components
|
|||||||
_meshRenderer.material.SetFloat(Alpha, CurrentOpacity);
|
_meshRenderer.material.SetFloat(Alpha, CurrentOpacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOpacityCurve(VariableSizeModule.TimeValuePair[] curve)
|
public void SetOpacityCurve(TimeValuePair[] curve)
|
||||||
{
|
{
|
||||||
opacityCurve = new AnimationCurve();
|
opacityCurve = new AnimationCurve();
|
||||||
foreach (var pair in curve)
|
foreach (var pair in curve)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Components.SizeControllers
|
namespace NewHorizons.Components.SizeControllers
|
||||||
{
|
{
|
||||||
@ -22,7 +23,7 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
base.transform.localScale = Vector3.one * CurrentScale;
|
base.transform.localScale = Vector3.one * CurrentScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScaleCurve(VariableSizeModule.TimeValuePair[] curve)
|
public void SetScaleCurve(TimeValuePair[] curve)
|
||||||
{
|
{
|
||||||
scaleCurve = new AnimationCurve();
|
scaleCurve = new AnimationCurve();
|
||||||
foreach (var pair in curve)
|
foreach (var pair in curve)
|
||||||
|
|||||||
6
NewHorizons/External/Configs/PlanetConfig.cs
vendored
6
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -362,6 +362,12 @@ namespace NewHorizons.External.Configs
|
|||||||
if (!string.IsNullOrEmpty(Cloak.audioClip)) Cloak.audio = Cloak.audioClip;
|
if (!string.IsNullOrEmpty(Cloak.audioClip)) Cloak.audio = Cloak.audioClip;
|
||||||
if (!string.IsNullOrEmpty(Cloak.audioFilePath)) Cloak.audio = Cloak.audioFilePath;
|
if (!string.IsNullOrEmpty(Cloak.audioFilePath)) Cloak.audio = Cloak.audioFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rings are no longer variable size module
|
||||||
|
if (Ring != null)
|
||||||
|
{
|
||||||
|
if (Ring.curve != null) Ring.scaleCurve = Ring.curve;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,12 @@
|
|||||||
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using NewHorizons.Utility;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace NewHorizons.External.Modules.VariableSize
|
namespace NewHorizons.External.Modules
|
||||||
{
|
{
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class RingModule : VariableSizeModule
|
public class RingModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fluid type for sounds/effects when colliding with this ring.
|
/// Fluid type for sounds/effects when colliding with this ring.
|
||||||
@ -46,6 +48,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool unlit;
|
public bool unlit;
|
||||||
|
|
||||||
|
#region Obsolete
|
||||||
|
[Obsolete("curve is deprecated, please use scaleCurve instead")]
|
||||||
|
public TimeValuePair[] curve;
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scale rings over time. Optional. Value between 0-1, time is in minutes.
|
/// Scale rings over time. Optional. Value between 0-1, time is in minutes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
using NewHorizons.Utility;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -7,22 +8,8 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
public class VariableSizeModule
|
public class VariableSizeModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scale this module over time
|
/// Scale this object over time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TimeValuePair[] curve;
|
public TimeValuePair[] curve;
|
||||||
|
|
||||||
[JsonObject]
|
|
||||||
public class TimeValuePair
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A specific point in time
|
|
||||||
/// </summary>
|
|
||||||
public float time;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The value for this point in time
|
|
||||||
/// </summary>
|
|
||||||
public float value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
|
||||||
|
|
||||||
namespace NewHorizons.Handlers
|
namespace NewHorizons.Handlers
|
||||||
{
|
{
|
||||||
|
|||||||
18
NewHorizons/Utility/TimeValuePair.cs
Normal file
18
NewHorizons/Utility/TimeValuePair.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace NewHorizons.Utility
|
||||||
|
{
|
||||||
|
[JsonObject]
|
||||||
|
public class TimeValuePair
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A specific point in time
|
||||||
|
/// </summary>
|
||||||
|
public float time;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The value for this point in time
|
||||||
|
/// </summary>
|
||||||
|
public float value;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user