mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add colours and fix orientation
This commit is contained in:
parent
d81dde6ea0
commit
944ba3fde3
BIN
NewHorizons/Assets/textures/Effects_CO_GasTail_d.png
Normal file
BIN
NewHorizons/Assets/textures/Effects_CO_GasTail_d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 254 B |
@ -2,6 +2,7 @@ using NewHorizons.Components.SizeControllers;
|
|||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
|
using NewHorizons.Utility.Files;
|
||||||
using NewHorizons.Utility.OuterWilds;
|
using NewHorizons.Utility.OuterWilds;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -93,6 +94,25 @@ namespace NewHorizons.Builder.Body
|
|||||||
gasTail.SetActive(true);
|
gasTail.SetActive(true);
|
||||||
controller.gasTail = gasTail;
|
controller.gasTail = gasTail;
|
||||||
|
|
||||||
|
if (cometTailModule.dustTint != null)
|
||||||
|
{
|
||||||
|
foreach (var dust in dustTail.GetComponentsInChildren<MeshRenderer>())
|
||||||
|
{
|
||||||
|
var untintedDust = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Effects_CO_DustTail_d.png");
|
||||||
|
dust.material.mainTexture = ImageUtilities.TintImage(untintedDust, cometTailModule.dustTint.ToColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cometTailModule.gasTint != null)
|
||||||
|
{
|
||||||
|
foreach (var gas in gasTail.GetComponentsInChildren<MeshRenderer>())
|
||||||
|
{
|
||||||
|
var untintedGas = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Effects_CO_GasTail_d.png");
|
||||||
|
gas.material.mainTexture = untintedGas;
|
||||||
|
gas.material.color = cometTailModule.gasTint.ToColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rootObj.SetActive(true);
|
rootObj.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,18 +18,9 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
private Vector3 _gasTarget;
|
private Vector3 _gasTarget;
|
||||||
private Vector3 _dustTarget;
|
private Vector3 _dustTarget;
|
||||||
|
|
||||||
private float _angularVelocity = 1f;
|
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
_body = transform.GetAttachedOWRigidbody();
|
_body = transform.GetAttachedOWRigidbody();
|
||||||
|
|
||||||
if (!_hasRotationOverride && _hasPrimaryBody)
|
|
||||||
{
|
|
||||||
UpdateTargetPositions();
|
|
||||||
dustTail?.transform?.LookAt(_dustTarget);
|
|
||||||
gasTail?.transform?.LookAt(_gasTarget);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void FixedUpdate()
|
public override void FixedUpdate()
|
||||||
@ -40,8 +31,8 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
{
|
{
|
||||||
UpdateTargetPositions();
|
UpdateTargetPositions();
|
||||||
|
|
||||||
dustTail?.SmoothLookAt(_dustTarget, Time.deltaTime, _angularVelocity);
|
dustTail?.LookDir(_dustTarget);
|
||||||
gasTail?.SmoothLookAt(_gasTarget, Time.deltaTime, _angularVelocity);
|
gasTail?.LookDir(_gasTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
NewHorizons/External/Modules/CometTailModule.cs
vendored
10
NewHorizons/External/Modules/CometTailModule.cs
vendored
@ -21,5 +21,15 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The body that the comet tail should always point away from
|
/// The body that the comet tail should always point away from
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string primaryBody;
|
public string primaryBody;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Colour of the dust tail (the shorter part)
|
||||||
|
/// </summary>
|
||||||
|
public MColor dustTint;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Colour of the gas tail (the longer part)
|
||||||
|
/// </summary>
|
||||||
|
public MColor gasTint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -256,14 +256,19 @@ namespace NewHorizons.Utility
|
|||||||
|
|
||||||
public static FluidVolume.Type ConvertToOW(this NHFluidType fluidType, FluidVolume.Type @default = FluidVolume.Type.NONE) => EnumUtils.Parse(fluidType.ToString().ToUpper(), @default);
|
public static FluidVolume.Type ConvertToOW(this NHFluidType fluidType, FluidVolume.Type @default = FluidVolume.Type.NONE) => EnumUtils.Parse(fluidType.ToString().ToUpper(), @default);
|
||||||
|
|
||||||
public static void SmoothLookAt(this GameObject go, Vector3 direction, float dt, float angularVelocity)
|
public static void SmoothLookDir(this GameObject go, Vector3 direction, float dt, float angularVelocity)
|
||||||
{
|
{
|
||||||
var start = go.transform.rotation;
|
var start = go.transform.rotation;
|
||||||
var end = Quaternion.FromToRotation(Vector3.forward, direction);
|
var end = Quaternion.FromToRotation(Vector3.forward, direction);
|
||||||
|
|
||||||
var angle = Quaternion.Angle(start, end);
|
var angle = Quaternion.Angle(start, end);
|
||||||
|
|
||||||
go.transform.rotation = Quaternion.Slerp(start, end, angularVelocity / angle * dt * dt);
|
go.transform.rotation = Quaternion.Slerp(start, end, (angularVelocity / angle) * dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LookDir(this GameObject go, Vector3 direction)
|
||||||
|
{
|
||||||
|
go.transform.rotation = Quaternion.FromToRotation(Vector3.forward, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user