Heat System v2 + Lasers
Heat system remade, now guaranteed stable Schematic heat texture is now Radiators glow according to temperature Added Laser weapons Longinus has split weapon and radiator meshes, weapons can yaw 1 degree for target convergence Articulation points can now handle 360 rotations properly Fixed exception caused by hit spread on thin hull sections Fixed loadout not restoring item rotation Fixed exception in inventory panel selection
This commit is contained in:
parent
357f9db329
commit
b779d7c0af
43 changed files with 6898 additions and 227 deletions
|
|
@ -56,6 +56,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
public List<EntityPack> Loadouts { get; set; } = new List<EntityPack>();
|
||||
|
||||
// private ShipInput _shipInput;
|
||||
private IDisposable _shipTargetSubscription;
|
||||
private float2 _shipYawPitch;
|
||||
private float3 _viewDirection;
|
||||
private (HardpointData[] hardpoints, Transform[] barrels, PlaceUIElementWorldspace crosshair)[] _articulationGroups;
|
||||
|
|
@ -377,16 +378,6 @@ public class ActionGameManager : MonoBehaviour
|
|||
var ship = new Ship(ItemManager, Zone, shipHull);
|
||||
PlayerShips.Add(ship);
|
||||
CurrentShip = ship;
|
||||
CurrentShip.Target.Subscribe(target =>
|
||||
{
|
||||
TargetIndicator.gameObject.SetActive(CurrentShip.Target.Value != null);
|
||||
TargetShipPanel.gameObject.SetActive(target != null);
|
||||
if (target != null)
|
||||
{
|
||||
TargetShipPanel.Display(target, true);
|
||||
TargetSchematicDisplay.ShowShip(target, CurrentShip);
|
||||
}
|
||||
});
|
||||
ship.ArmorDamage.Subscribe(hit =>
|
||||
{
|
||||
var direction = _directions.MaxBy(d => dot(d.direction, normalize(hit.pos - hullType.Shape.CenterOfMass)));
|
||||
|
|
@ -530,6 +521,22 @@ public class ActionGameManager : MonoBehaviour
|
|||
return (x, i, i.GetComponent<Rotate>());
|
||||
}).ToArray();
|
||||
|
||||
CurrentShip.HullDamage.Subscribe(f =>
|
||||
{
|
||||
if (float.IsNaN(CurrentShip.Hull.Durability))
|
||||
Debug.Log("WTF!");
|
||||
});
|
||||
_shipTargetSubscription?.Dispose();
|
||||
_shipTargetSubscription = CurrentShip.Target.Subscribe(target =>
|
||||
{
|
||||
TargetIndicator.gameObject.SetActive(CurrentShip.Target.Value != null);
|
||||
TargetShipPanel.gameObject.SetActive(target != null);
|
||||
if (target != null)
|
||||
{
|
||||
TargetShipPanel.Display(target, true);
|
||||
TargetSchematicDisplay.ShowShip(target, CurrentShip);
|
||||
}
|
||||
});
|
||||
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
GameplayUI.SetActive(true);
|
||||
|
|
@ -623,10 +630,12 @@ public class ActionGameManager : MonoBehaviour
|
|||
var showLockingIndicator = targetLock.Lock > .01f && CurrentShip.Target.Value != null;
|
||||
indicator.gameObject.SetActive(showLockingIndicator);
|
||||
if(showLockingIndicator)
|
||||
indicator.Target = CurrentShip.Target.Value.Position;
|
||||
indicator.NoiseAmplitude = Settings.GameplaySettings.LockIndicatorNoiseAmplitude * (1 - targetLock.Lock);
|
||||
indicator.NoiseFrequency = Settings.GameplaySettings.LockIndicatorFrequency.Evaluate(targetLock.Lock);
|
||||
spin.Speed = Settings.GameplaySettings.LockSpinSpeed.Evaluate(targetLock.Lock);
|
||||
{
|
||||
indicator.Target = CurrentShip.Target.Value.Position;
|
||||
indicator.NoiseAmplitude = Settings.GameplaySettings.LockIndicatorNoiseAmplitude * (1 - targetLock.Lock);
|
||||
indicator.NoiseFrequency = Settings.GameplaySettings.LockIndicatorFrequency.Evaluate(targetLock.Lock);
|
||||
spin.Speed = Settings.GameplaySettings.LockSpinSpeed.Evaluate(targetLock.Lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,18 +25,23 @@ public class ArticulationPoint : MonoBehaviour
|
|||
{
|
||||
if (Target)
|
||||
{
|
||||
var targetLocal = transform.parent.InverseTransformPoint(Target.position);
|
||||
var targetLocal = transform.InverseTransformPoint(Target.position);
|
||||
|
||||
var yaw = Vector2.SignedAngle(new Vector2(0, 1), new Vector2(targetLocal.x, targetLocal.z));
|
||||
var pitch = Vector2.SignedAngle(new Vector2(1, 0), new Vector2(targetLocal.z, targetLocal.y));
|
||||
|
||||
var targetYaw = clamp(-yaw, YawMin, YawMax);
|
||||
var targetPitch = clamp(-pitch, PitchMin, PitchMax);
|
||||
|
||||
var targetYaw = clamp(_yaw - yaw, YawMin, YawMax);
|
||||
var targetPitch = clamp(_pitch - pitch, PitchMin, PitchMax);
|
||||
|
||||
if (abs(targetYaw - _yaw) < Speed * Time.deltaTime)
|
||||
_yaw = targetYaw;
|
||||
else _yaw = _yaw + sign(targetYaw - _yaw) * Speed * Time.deltaTime;
|
||||
|
||||
if(_yaw < -360)
|
||||
_yaw += 360;
|
||||
if(_yaw > 360)
|
||||
_yaw -= 360;
|
||||
|
||||
if (abs(targetPitch - _pitch) < Speed * Time.deltaTime)
|
||||
_pitch = targetPitch;
|
||||
else _pitch = _pitch + sign(targetPitch - _pitch) * Speed * Time.deltaTime;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ public class EntityPrefab : MonoBehaviour
|
|||
{
|
||||
public HullCollider[] HullColliders;
|
||||
|
||||
public RadiatorHardpoint[] RadiatorHardpoints;
|
||||
public ThrusterHardpoint[] ThrusterHardpoints;
|
||||
public WeaponHardpoint[] WeaponHardpoints;
|
||||
public ArticulationPoint[] ArticulationPoints;
|
||||
|
|
|
|||
8
Assets/Scripts/Gameplay/RadiatorHardpoint.cs
Normal file
8
Assets/Scripts/Gameplay/RadiatorHardpoint.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RadiatorHardpoint : MonoBehaviour
|
||||
{
|
||||
public MeshRenderer Mesh;
|
||||
}
|
||||
11
Assets/Scripts/Gameplay/RadiatorHardpoint.cs.meta
Normal file
11
Assets/Scripts/Gameplay/RadiatorHardpoint.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d97beae3dbfd7514c94059c020f57c9d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,13 +1,56 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Laser : MonoBehaviour
|
||||
{
|
||||
public AnimationCurve IntensityCurve;
|
||||
public float Duration;
|
||||
public LineRenderer LineRenderer;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public Entity SourceEntity { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
||||
private float _startTime;
|
||||
private readonly Vector3[] _zeros = {Vector3.zero, Vector3.zero};
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_startTime = Time.time;
|
||||
LineRenderer.SetPositions(_zeros);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var lerp = (Time.time - _startTime) / Duration;
|
||||
if (lerp > 1)
|
||||
{
|
||||
GetComponent<Prototype>().ReturnToPool();
|
||||
return;
|
||||
}
|
||||
|
||||
LineRenderer.SetPosition(0, transform.position);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(new Ray(transform.position, transform.forward), out hit, Range, 1))
|
||||
{
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull)
|
||||
{
|
||||
if (hull.Entity != SourceEntity)
|
||||
{
|
||||
hull.SendHit(Damage * (Time.deltaTime / Duration), Penetration, Spread, DamageType, SourceEntity, hit, transform.forward);
|
||||
}
|
||||
}
|
||||
LineRenderer.SetPosition(1, hit.point);
|
||||
}
|
||||
else
|
||||
LineRenderer.SetPosition(1, transform.position + transform.forward * Range);
|
||||
|
||||
LineRenderer.widthMultiplier = IntensityCurve.Evaluate(lerp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ MonoImporter:
|
|||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
executionOrder: 80
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
|
|
|||
Loading…
Reference in a new issue