Sensor Ping
Added ping feature to sensors, pulsing a wave of revealing light into the level Added IEventBehavior interface, used by sensors and weapons, for behaviors containing event subscriptions which need to be reset when EntityInstance is disposed Implemented sensor impact for locked weapons (lock speed varies with sensor acquisition) Added ping cooldown bar to HUD Added spline curve implementations to AetheriaMath, applied better mapping to wormhole transition animation Tweaked loadout generator to prefer larger items to a controllable degree (e.g. very important for cargo bays, less for shop inventory), shop inventory bans non-ship hulls and manages internal space more effectively
This commit is contained in:
parent
fd81bf267e
commit
645fcf4b09
62 changed files with 115821 additions and 79 deletions
|
|
@ -10,6 +10,7 @@ using float2 = Unity.Mathematics.float2;
|
|||
|
||||
public class EntityInstance : MonoBehaviour
|
||||
{
|
||||
public Transform PingPrefab;
|
||||
public Material InvisibleMaterial;
|
||||
public static Transform EffectManagerParent;
|
||||
public ShieldManager Shield;
|
||||
|
|
@ -37,6 +38,9 @@ public class EntityInstance : MonoBehaviour
|
|||
private bool _unfadedElementsVisible = false;
|
||||
private float _fadeTime;
|
||||
private bool _destroyed;
|
||||
private (Transform transform, MeshRenderer meshRenderer) _currentPing;
|
||||
private float _pingBrightness;
|
||||
private Sensor _sensor;
|
||||
|
||||
private (Reactor reactor, GameObject sfxSource) _reactor;
|
||||
private Dictionary<Radiator, GameObject> _radiatorSfx = new Dictionary<Radiator, GameObject>();
|
||||
|
|
@ -152,6 +156,20 @@ public class EntityInstance : MonoBehaviour
|
|||
{
|
||||
foreach (var behavior in item.Behaviors)
|
||||
{
|
||||
if (behavior is Sensor sensor)
|
||||
{
|
||||
_sensor = sensor;
|
||||
sensor.OnPingStart += () =>
|
||||
{
|
||||
var pingInstance = Instantiate(PingPrefab);
|
||||
var pingMesh = pingInstance.GetComponent<MeshRenderer>();
|
||||
pingInstance.position = entity.Position;
|
||||
_pingBrightness = pingMesh.material.GetFloat("_Depth");
|
||||
_currentPing = (pingInstance, pingMesh);
|
||||
};
|
||||
sensor.OnPingEnd += () => Destroy(_currentPing.transform.gameObject);
|
||||
}
|
||||
|
||||
if (behavior is InstantWeapon instantWeapon)
|
||||
{
|
||||
var data = (InstantWeaponData) instantWeapon.Data;
|
||||
|
|
@ -427,6 +445,11 @@ public class EntityInstance : MonoBehaviour
|
|||
|
||||
public virtual void Update()
|
||||
{
|
||||
if (_currentPing.transform)
|
||||
{
|
||||
_currentPing.transform.localScale = _sensor.PingRadius * Vector3.one;
|
||||
_currentPing.meshRenderer.material.SetFloat("_Depth", _pingBrightness * _sensor.PingBrightness);
|
||||
}
|
||||
if (_fading)
|
||||
{
|
||||
if (_fadingIn)
|
||||
|
|
|
|||
Loading…
Reference in a new issue