2026-08-10 14:57:50 +01:00
|
|
|
|
using System;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using UniRx;
|
|
|
|
|
|
using UnityEngine;
|
2026-09-14 17:39:12 +02:00
|
|
|
|
using CultMath;
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
using CultMath.UnityBridge;
|
2026-09-14 17:39:12 +02:00
|
|
|
|
using static CultMath.math;
|
|
|
|
|
|
using float2 = CultMath.float2;
|
2026-08-10 14:57:50 +01:00
|
|
|
|
using Random = UnityEngine.Random;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
|
|
|
|
|
|
public class EntityInstance : MonoBehaviour
|
|
|
|
|
|
{
|
2021-05-12 00:15:11 +01:00
|
|
|
|
public MeshRenderer MapIcon;
|
2021-05-02 20:59:45 +01:00
|
|
|
|
public Transform InfluencePrefab;
|
2026-08-10 14:57:50 +01:00
|
|
|
|
public Transform PingPrefab;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public Material InvisibleMaterial;
|
2026-08-10 14:57:50 +01:00
|
|
|
|
public static Transform EffectManagerParent;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public ShieldManager Shield;
|
|
|
|
|
|
public HullCollider[] HullColliders;
|
|
|
|
|
|
|
2021-03-16 16:35:23 +00:00
|
|
|
|
public Transform[] EquipmentHardpoints;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public RadiatorHardpoint[] RadiatorHardpoints;
|
|
|
|
|
|
public ThrusterHardpoint[] ThrusterHardpoints;
|
|
|
|
|
|
public WeaponHardpoint[] WeaponHardpoints;
|
|
|
|
|
|
public ArticulationPoint[] ArticulationPoints;
|
|
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
public GameObject DestroyEffect;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
|
|
|
|
|
|
public event Action OnFadedOut;
|
|
|
|
|
|
public event Action OnFadedIn;
|
|
|
|
|
|
|
|
|
|
|
|
private List<Material> _fadeMaterials = new List<Material>();
|
|
|
|
|
|
private Dictionary<MeshRenderer, Material[]> _meshes = new Dictionary<MeshRenderer, Material[]>();
|
|
|
|
|
|
private List<(MeshRenderer mesh, int submesh, Material material)> _nonFadedSubmeshes = new List<(MeshRenderer mesh, int submesh, Material material)>();
|
|
|
|
|
|
private List<IDisposable> _subscriptions = new List<IDisposable>();
|
|
|
|
|
|
private float _fade = 0;
|
|
|
|
|
|
private bool _fading;
|
|
|
|
|
|
private bool _fadingIn;
|
|
|
|
|
|
private bool _fadedElementsVisible = false;
|
|
|
|
|
|
private bool _unfadedElementsVisible = false;
|
|
|
|
|
|
private float _fadeTime;
|
2026-08-10 14:57:50 +01:00
|
|
|
|
private bool _destroyed;
|
|
|
|
|
|
private (Transform transform, MeshRenderer meshRenderer) _currentPing;
|
|
|
|
|
|
private float _pingBrightness;
|
|
|
|
|
|
private Sensor _sensor;
|
2021-05-02 20:59:45 +01:00
|
|
|
|
private Transform _influenceInstance;
|
2021-04-30 06:39:57 +01:00
|
|
|
|
|
2022-07-10 02:53:09 +01:00
|
|
|
|
//private List<(GameObject source, EquippedItem item)> _audioSources = new List<(GameObject source, EquippedItem item)>();
|
2021-04-30 06:39:57 +01:00
|
|
|
|
// private (Reactor reactor, GameObject sfxSource) _reactor;
|
|
|
|
|
|
// private Dictionary<Radiator, GameObject> _radiatorSfx = new Dictionary<Radiator, GameObject>();
|
2021-03-16 16:35:23 +00:00
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
private static Dictionary<InstantWeaponData, InstantWeaponEffectManager> _instantWeaponManagers = new Dictionary<InstantWeaponData, InstantWeaponEffectManager>();
|
|
|
|
|
|
private static Dictionary<ConstantWeaponData, ConstantWeaponEffectManager> _constantWeaponManagers = new Dictionary<ConstantWeaponData, ConstantWeaponEffectManager>();
|
2026-06-14 03:37:27 +01:00
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
public static void ClearWeaponManagers()
|
|
|
|
|
|
{
|
|
|
|
|
|
_instantWeaponManagers.Clear();
|
|
|
|
|
|
_constantWeaponManagers.Clear();
|
|
|
|
|
|
}
|
2026-06-14 03:37:27 +01:00
|
|
|
|
|
2021-05-12 13:49:04 +01:00
|
|
|
|
public CompassIcon CompassIcon { get; set; }
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public Dictionary<HardpointData, Transform[]> Barrels { get; private set; }
|
|
|
|
|
|
public Dictionary<HardpointData, int> BarrelIndices { get; private set; }
|
2021-03-01 01:53:56 +00:00
|
|
|
|
public Dictionary<Radiator, MeshRenderer> RadiatorMeshes { get; private set; }
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public Transform LookAtPoint { get; private set; }
|
|
|
|
|
|
public Entity Entity { get; private set; }
|
2021-03-15 11:40:46 +00:00
|
|
|
|
public ZoneRenderer ZoneRenderer { get; private set; }
|
2021-04-15 04:25:22 +01:00
|
|
|
|
public Transform LocalSpace { get; private set; }
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public bool Visible
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _fade > 0.01f;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
2021-04-15 04:25:22 +01:00
|
|
|
|
LocalSpace = new GameObject().transform;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
var meshes = gameObject.GetComponentsInChildren<MeshRenderer>();
|
|
|
|
|
|
var materials = new List<(Material material, List<(MeshRenderer renderer, int index)> submeshes)>();
|
|
|
|
|
|
foreach (var mesh in meshes)
|
|
|
|
|
|
{
|
|
|
|
|
|
_meshes.Add(mesh, mesh.sharedMaterials);
|
|
|
|
|
|
for (var i = 0; i < mesh.sharedMaterials.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var material = mesh.sharedMaterials[i];
|
|
|
|
|
|
if (material.shader.FindPropertyIndex("_Fade") >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var match = materials.FirstOrDefault(lm => lm.material == material);
|
|
|
|
|
|
if(match.material==null || material.shader.FindPropertyIndex("_EmissionFresnel") >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
match = (material, new List<(MeshRenderer renderer, int index)>());
|
|
|
|
|
|
materials.Add(match);
|
|
|
|
|
|
}
|
|
|
|
|
|
match.submeshes.Add((mesh, i));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
_nonFadedSubmeshes.Add((mesh, i, material));
|
|
|
|
|
|
_meshes[mesh][i] = InvisibleMaterial;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var (material, submeshes) in materials)
|
|
|
|
|
|
{
|
|
|
|
|
|
var materialInstance = Instantiate(material);
|
|
|
|
|
|
_fadeMaterials.Add(materialInstance);
|
|
|
|
|
|
foreach (var (mesh, index) in submeshes)
|
|
|
|
|
|
{
|
|
|
|
|
|
_meshes[mesh][index] = materialInstance;
|
|
|
|
|
|
}
|
|
|
|
|
|
materialInstance.SetFloat("_Fade", 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var mesh in _meshes.Keys) mesh.enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var mesh in _meshes) mesh.Key.sharedMaterials = mesh.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void ShowUnfadedElements()
|
|
|
|
|
|
{
|
|
|
|
|
|
_unfadedElementsVisible = true;
|
|
|
|
|
|
foreach (var (mesh, submesh, material) in _nonFadedSubmeshes) _meshes[mesh][submesh] = material;
|
|
|
|
|
|
foreach (var mesh in _meshes) mesh.Key.sharedMaterials = mesh.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void HideUnfadedElements()
|
|
|
|
|
|
{
|
|
|
|
|
|
_unfadedElementsVisible = false;
|
|
|
|
|
|
foreach (var (mesh, submesh, material) in _nonFadedSubmeshes) _meshes[mesh][submesh] = InvisibleMaterial;
|
|
|
|
|
|
foreach (var mesh in _meshes) mesh.Key.sharedMaterials = mesh.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void FadeIn(float time)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_fade > .99f)
|
|
|
|
|
|
{
|
|
|
|
|
|
_fading = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
_fadeTime = time;
|
|
|
|
|
|
_fading = true;
|
|
|
|
|
|
_fadingIn = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void FadeOut(float time)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_fade < .01f)
|
|
|
|
|
|
{
|
|
|
|
|
|
_fading = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
_fadeTime = time;
|
|
|
|
|
|
_fading = true;
|
|
|
|
|
|
_fadingIn = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-03-15 11:40:46 +00:00
|
|
|
|
public virtual void SetEntity(ZoneRenderer zoneRenderer, Entity entity)
|
2021-02-26 19:01:47 +00:00
|
|
|
|
{
|
|
|
|
|
|
gameObject.name = entity.Name;
|
2021-04-15 04:25:22 +01:00
|
|
|
|
LocalSpace.gameObject.name = $"{entity.Name} Sim Space";
|
|
|
|
|
|
LocalSpace.SetParent(transform.parent);
|
2021-02-26 19:01:47 +00:00
|
|
|
|
Entity = entity;
|
2021-03-15 11:40:46 +00:00
|
|
|
|
ZoneRenderer = zoneRenderer;
|
2026-08-10 14:57:50 +01:00
|
|
|
|
var hullData = entity.ItemManager.GetData(entity.Hull) as HullData;
|
2026-06-14 03:37:27 +01:00
|
|
|
|
|
2021-02-26 19:01:47 +00:00
|
|
|
|
if(Shield)
|
|
|
|
|
|
Shield.Entity = entity;
|
|
|
|
|
|
foreach (var hullCollider in HullColliders) hullCollider.Entity = entity;
|
|
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
foreach (var item in entity.Equipment)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var behavior in item.Behaviors)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (behavior is Sensor sensor)
|
|
|
|
|
|
{
|
|
|
|
|
|
_sensor = sensor;
|
|
|
|
|
|
sensor.OnPingStart += () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var pingInstance = Instantiate(PingPrefab);
|
|
|
|
|
|
var pingMesh = pingInstance.GetComponent<MeshRenderer>();
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
pingInstance.position = entity.Position.ToUnity();
|
2026-08-10 14:57:50 +01:00
|
|
|
|
_pingBrightness = pingMesh.material.GetFloat("_Depth");
|
|
|
|
|
|
_currentPing = (pingInstance, pingMesh);
|
|
|
|
|
|
};
|
|
|
|
|
|
sensor.OnPingEnd += OnSensorPingEnd;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (behavior is InstantWeapon instantWeapon)
|
|
|
|
|
|
{
|
|
|
|
|
|
var data = (InstantWeaponData) instantWeapon.Data;
|
|
|
|
|
|
if (!_instantWeaponManagers.ContainsKey(data))
|
|
|
|
|
|
{
|
Switch engine asset references from Resources paths to Addressables GUIDs
Cut 2 of docs/addressables-cut.md. The asset move (git mv
Resources/{Prefabs,Schematics,Sprites/Icons} -> Content/...) and the
UnityHelpers.cs deletion already landed in 1fdf8151, picked up by a
concurrent session sharing this working tree; this commit is the rest
of Cut 2 landing on top of that shared state, atomically:
- Bump CultLib to cultlib-unity-v1.0.60 / caching-unity-v1.4.0 (both
45c2f40) in Packages/manifest.json, packages-lock.json and
Directory.Build.props, together with the 8 ServerShared
[CultInspectorAssetPath] usages becoming [CultInspectorAssetGuid] -
the .NET and Unity sides move together or nothing compiles.
- Assets/Scripts/EngineAssets.cs replaces UnityHelpers: loads an
Addressables key (bare GUID or guid[subAsset]) synchronously,
loading the GameObject and taking the component for the four sites
that load a component. ActionBarSlot, EntityInstance, ShipInstance
and ZoneRenderer call it instead of Resources.Load/UnityHelpers; the
inline "Assets/Resources/" prefix strips are gone with them.
CultCacheDrawers' schematic preview goes through
AssetDatabase.GUIDToAssetPath first.
- Assets/Scripts/Editor/EngineAssetCheck.cs validates every stored
[CultInspectorAssetGuid] value: 32 lowercase hex, resolves to a file,
is addressable, and satisfies its member's consumer-type contract
(Texture2D for icons/logos/schematics, a GameObject with the right
component for prefabs) - table-driven, so an attributed member with
no row fails loudly instead of being skipped.
- GameData/Aetheria.cc: the scratch migration (Aetheria.Shared + the
pinned CultLib revision, a throwaway console app, never landed)
walked all 138 attributed field slots across 180 documents,
rewriting the 30 non-empty Resources paths to their .meta GUIDs -
108 stayed empty, 0 unresolved, matching the map's census exactly.
Verification: dotnet test tests/Aetheria.Shared.Tests 61/61 green
against CultLib 45c2f40; Unity 6000.3.24f1 batchmode compiles clean;
EngineAssetCheck.Run passes all 30 stored references; the map's
negative greps are clean; tests/mutation_tests.py's 5 mutations (wrong
type, non-addressable, random guid, an old path, and an untabled
attributed member) are all caught and named, the control case and the
post-revert recompile stay clean, and the catalog/source are restored
byte-identical afterward.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 05:04:50 +02:00
|
|
|
|
var managerPrefab = EngineAssets.Load<InstantWeaponEffectManager>(data.EffectPrefab);
|
2026-08-10 14:57:50 +01:00
|
|
|
|
if(managerPrefab)
|
|
|
|
|
|
{
|
|
|
|
|
|
_instantWeaponManagers.Add(data, Instantiate(managerPrefab, EffectManagerParent));
|
|
|
|
|
|
}
|
Switch engine asset references from Resources paths to Addressables GUIDs
Cut 2 of docs/addressables-cut.md. The asset move (git mv
Resources/{Prefabs,Schematics,Sprites/Icons} -> Content/...) and the
UnityHelpers.cs deletion already landed in 1fdf8151, picked up by a
concurrent session sharing this working tree; this commit is the rest
of Cut 2 landing on top of that shared state, atomically:
- Bump CultLib to cultlib-unity-v1.0.60 / caching-unity-v1.4.0 (both
45c2f40) in Packages/manifest.json, packages-lock.json and
Directory.Build.props, together with the 8 ServerShared
[CultInspectorAssetPath] usages becoming [CultInspectorAssetGuid] -
the .NET and Unity sides move together or nothing compiles.
- Assets/Scripts/EngineAssets.cs replaces UnityHelpers: loads an
Addressables key (bare GUID or guid[subAsset]) synchronously,
loading the GameObject and taking the component for the four sites
that load a component. ActionBarSlot, EntityInstance, ShipInstance
and ZoneRenderer call it instead of Resources.Load/UnityHelpers; the
inline "Assets/Resources/" prefix strips are gone with them.
CultCacheDrawers' schematic preview goes through
AssetDatabase.GUIDToAssetPath first.
- Assets/Scripts/Editor/EngineAssetCheck.cs validates every stored
[CultInspectorAssetGuid] value: 32 lowercase hex, resolves to a file,
is addressable, and satisfies its member's consumer-type contract
(Texture2D for icons/logos/schematics, a GameObject with the right
component for prefabs) - table-driven, so an attributed member with
no row fails loudly instead of being skipped.
- GameData/Aetheria.cc: the scratch migration (Aetheria.Shared + the
pinned CultLib revision, a throwaway console app, never landed)
walked all 138 attributed field slots across 180 documents,
rewriting the 30 non-empty Resources paths to their .meta GUIDs -
108 stayed empty, 0 unresolved, matching the map's census exactly.
Verification: dotnet test tests/Aetheria.Shared.Tests 61/61 green
against CultLib 45c2f40; Unity 6000.3.24f1 batchmode compiles clean;
EngineAssetCheck.Run passes all 30 stored references; the map's
negative greps are clean; tests/mutation_tests.py's 5 mutations (wrong
type, non-addressable, random guid, an old path, and an untabled
attributed member) are all caught and named, the control case and the
post-revert recompile stay clean, and the catalog/source are restored
byte-identical afterward.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 05:04:50 +02:00
|
|
|
|
else Debug.LogError($"No InstantWeaponEffectManager prefab found for GUID {data.EffectPrefab}");
|
2026-08-10 14:57:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
instantWeapon.OnFire += () =>
|
|
|
|
|
|
_instantWeaponManagers[data].Fire(instantWeapon, item, this, entity.Target.Value != null && ZoneRenderer.EntityInstances.ContainsKey(entity.Target.Value) ? ZoneRenderer.EntityInstances[entity.Target.Value] : null);
|
|
|
|
|
|
|
|
|
|
|
|
if (behavior is ChargedWeapon chargedWeapon)
|
|
|
|
|
|
{
|
|
|
|
|
|
var chargeManager = _instantWeaponManagers[data].GetComponent<ChargeEffectManager>();
|
|
|
|
|
|
if (chargeManager)
|
|
|
|
|
|
{
|
|
|
|
|
|
chargedWeapon.OnStartCharging += () => chargeManager.StartCharging(chargedWeapon, item, this);
|
|
|
|
|
|
chargedWeapon.OnStopCharging += () => chargeManager.StopCharging(chargedWeapon);
|
|
|
|
|
|
chargedWeapon.OnCharged += () => chargeManager.Charged(chargedWeapon);
|
|
|
|
|
|
chargedWeapon.OnFailed += () => chargeManager.Failed(chargedWeapon);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (behavior is ConstantWeapon constantWeapon)
|
|
|
|
|
|
{
|
|
|
|
|
|
var data = (ConstantWeaponData) constantWeapon.Data;
|
|
|
|
|
|
if (!_constantWeaponManagers.ContainsKey(data))
|
|
|
|
|
|
{
|
Switch engine asset references from Resources paths to Addressables GUIDs
Cut 2 of docs/addressables-cut.md. The asset move (git mv
Resources/{Prefabs,Schematics,Sprites/Icons} -> Content/...) and the
UnityHelpers.cs deletion already landed in 1fdf8151, picked up by a
concurrent session sharing this working tree; this commit is the rest
of Cut 2 landing on top of that shared state, atomically:
- Bump CultLib to cultlib-unity-v1.0.60 / caching-unity-v1.4.0 (both
45c2f40) in Packages/manifest.json, packages-lock.json and
Directory.Build.props, together with the 8 ServerShared
[CultInspectorAssetPath] usages becoming [CultInspectorAssetGuid] -
the .NET and Unity sides move together or nothing compiles.
- Assets/Scripts/EngineAssets.cs replaces UnityHelpers: loads an
Addressables key (bare GUID or guid[subAsset]) synchronously,
loading the GameObject and taking the component for the four sites
that load a component. ActionBarSlot, EntityInstance, ShipInstance
and ZoneRenderer call it instead of Resources.Load/UnityHelpers; the
inline "Assets/Resources/" prefix strips are gone with them.
CultCacheDrawers' schematic preview goes through
AssetDatabase.GUIDToAssetPath first.
- Assets/Scripts/Editor/EngineAssetCheck.cs validates every stored
[CultInspectorAssetGuid] value: 32 lowercase hex, resolves to a file,
is addressable, and satisfies its member's consumer-type contract
(Texture2D for icons/logos/schematics, a GameObject with the right
component for prefabs) - table-driven, so an attributed member with
no row fails loudly instead of being skipped.
- GameData/Aetheria.cc: the scratch migration (Aetheria.Shared + the
pinned CultLib revision, a throwaway console app, never landed)
walked all 138 attributed field slots across 180 documents,
rewriting the 30 non-empty Resources paths to their .meta GUIDs -
108 stayed empty, 0 unresolved, matching the map's census exactly.
Verification: dotnet test tests/Aetheria.Shared.Tests 61/61 green
against CultLib 45c2f40; Unity 6000.3.24f1 batchmode compiles clean;
EngineAssetCheck.Run passes all 30 stored references; the map's
negative greps are clean; tests/mutation_tests.py's 5 mutations (wrong
type, non-addressable, random guid, an old path, and an untabled
attributed member) are all caught and named, the control case and the
post-revert recompile stay clean, and the catalog/source are restored
byte-identical afterward.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 05:04:50 +02:00
|
|
|
|
var managerPrefab = EngineAssets.Load<ConstantWeaponEffectManager>(data.EffectPrefab);
|
2026-08-10 14:57:50 +01:00
|
|
|
|
if(managerPrefab)
|
|
|
|
|
|
{
|
|
|
|
|
|
_constantWeaponManagers.Add(data, Instantiate(managerPrefab, EffectManagerParent));
|
|
|
|
|
|
}
|
Switch engine asset references from Resources paths to Addressables GUIDs
Cut 2 of docs/addressables-cut.md. The asset move (git mv
Resources/{Prefabs,Schematics,Sprites/Icons} -> Content/...) and the
UnityHelpers.cs deletion already landed in 1fdf8151, picked up by a
concurrent session sharing this working tree; this commit is the rest
of Cut 2 landing on top of that shared state, atomically:
- Bump CultLib to cultlib-unity-v1.0.60 / caching-unity-v1.4.0 (both
45c2f40) in Packages/manifest.json, packages-lock.json and
Directory.Build.props, together with the 8 ServerShared
[CultInspectorAssetPath] usages becoming [CultInspectorAssetGuid] -
the .NET and Unity sides move together or nothing compiles.
- Assets/Scripts/EngineAssets.cs replaces UnityHelpers: loads an
Addressables key (bare GUID or guid[subAsset]) synchronously,
loading the GameObject and taking the component for the four sites
that load a component. ActionBarSlot, EntityInstance, ShipInstance
and ZoneRenderer call it instead of Resources.Load/UnityHelpers; the
inline "Assets/Resources/" prefix strips are gone with them.
CultCacheDrawers' schematic preview goes through
AssetDatabase.GUIDToAssetPath first.
- Assets/Scripts/Editor/EngineAssetCheck.cs validates every stored
[CultInspectorAssetGuid] value: 32 lowercase hex, resolves to a file,
is addressable, and satisfies its member's consumer-type contract
(Texture2D for icons/logos/schematics, a GameObject with the right
component for prefabs) - table-driven, so an attributed member with
no row fails loudly instead of being skipped.
- GameData/Aetheria.cc: the scratch migration (Aetheria.Shared + the
pinned CultLib revision, a throwaway console app, never landed)
walked all 138 attributed field slots across 180 documents,
rewriting the 30 non-empty Resources paths to their .meta GUIDs -
108 stayed empty, 0 unresolved, matching the map's census exactly.
Verification: dotnet test tests/Aetheria.Shared.Tests 61/61 green
against CultLib 45c2f40; Unity 6000.3.24f1 batchmode compiles clean;
EngineAssetCheck.Run passes all 30 stored references; the map's
negative greps are clean; tests/mutation_tests.py's 5 mutations (wrong
type, non-addressable, random guid, an old path, and an untabled
attributed member) are all caught and named, the control case and the
post-revert recompile stay clean, and the catalog/source are restored
byte-identical afterward.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 05:04:50 +02:00
|
|
|
|
else Debug.LogError($"No ConstantWeaponEffectManager prefab found for GUID {data.EffectPrefab}");
|
2026-08-10 14:57:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constantWeapon.OnStartFiring += () =>
|
|
|
|
|
|
_constantWeaponManagers[data].StartFiring(data, item, this, entity.Target.Value != null ? ZoneRenderer.EntityInstances[entity.Target.Value] : null);
|
|
|
|
|
|
constantWeapon.OnStopFiring += () =>
|
|
|
|
|
|
_constantWeaponManagers[data].StopFiring(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var hp = Entity.Hardpoints[item.Position.x, item.Position.y];
|
|
|
|
|
|
if (hp != null && item.Data.SoundBank != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var hardpointTransform = EquipmentHardpoints.FirstOrDefault(x => x.name == hp.Transform);
|
|
|
|
|
|
if (hardpointTransform != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var hardpointGameObject = hardpointTransform.gameObject;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-01 01:53:56 +00:00
|
|
|
|
RadiatorMeshes = new Dictionary<Radiator, MeshRenderer>();
|
2021-02-26 19:01:47 +00:00
|
|
|
|
Barrels = new Dictionary<HardpointData, Transform[]>();
|
|
|
|
|
|
BarrelIndices = new Dictionary<HardpointData, int>();
|
2021-03-01 01:53:56 +00:00
|
|
|
|
foreach (var radiator in entity.GetBehaviors<Radiator>())
|
2021-02-26 19:01:47 +00:00
|
|
|
|
{
|
2021-03-01 01:53:56 +00:00
|
|
|
|
var hp = Entity.Hardpoints[radiator.Item.Position.x, radiator.Item.Position.y];
|
|
|
|
|
|
if (hp != null && hp.Type == HardpointType.Radiator)
|
2021-02-26 19:01:47 +00:00
|
|
|
|
{
|
|
|
|
|
|
var mesh = RadiatorHardpoints.FirstOrDefault(x => x.name == hp.Transform);
|
|
|
|
|
|
if (mesh)
|
|
|
|
|
|
{
|
2021-03-01 01:53:56 +00:00
|
|
|
|
RadiatorMeshes.Add(radiator, mesh.Mesh);
|
2021-02-26 19:01:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-01 01:53:56 +00:00
|
|
|
|
}
|
2026-08-10 14:57:50 +01:00
|
|
|
|
foreach (var hp in hullData.Hardpoints)
|
2021-03-01 01:53:56 +00:00
|
|
|
|
{
|
2021-02-26 19:01:47 +00:00
|
|
|
|
if(hp.Type == HardpointType.Ballistic || hp.Type == HardpointType.Energy || hp.Type == HardpointType.Launcher)
|
|
|
|
|
|
{
|
|
|
|
|
|
var whp = WeaponHardpoints.FirstOrDefault(x => x.name == hp.Transform);
|
|
|
|
|
|
if (whp)
|
|
|
|
|
|
{
|
|
|
|
|
|
Barrels.Add(hp, whp.FiringPoint);
|
|
|
|
|
|
BarrelIndices.Add(hp, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
void DamageSchematic(float damage, Shape hitShape)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var v in hitShape.Coordinates)
|
|
|
|
|
|
hitShape[v] = hitShape[v] && hullData.Shape[v];
|
|
|
|
|
|
|
|
|
|
|
|
float hullDamage = 0;
|
|
|
|
|
|
var damagePerCell = damage / hitShape.Coordinates.Length;
|
|
|
|
|
|
foreach (var v in hitShape.Coordinates)
|
|
|
|
|
|
{
|
|
|
|
|
|
var d = damagePerCell;
|
|
|
|
|
|
|
|
|
|
|
|
// Subtract surface damage from armor, passing on the remainder to the item and then to the hull
|
|
|
|
|
|
var prev = entity.Armor[v.x, v.y];
|
|
|
|
|
|
entity.Armor[v.x, v.y] = max(prev - d, 0);
|
|
|
|
|
|
entity.ArmorDamage.OnNext((v, d));
|
|
|
|
|
|
d = max(d - prev, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (d > 0.1f)
|
|
|
|
|
|
{
|
|
|
|
|
|
var item = entity.GearOccupancy[v.x, v.y];
|
|
|
|
|
|
if (item != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
prev = item.EquippableItem.Durability;
|
|
|
|
|
|
item.EquippableItem.Durability = max(prev - d, 0);
|
|
|
|
|
|
entity.ItemDamage.OnNext((item, d));
|
|
|
|
|
|
d = max(d - prev, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
hullDamage += d;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(hullDamage > .1f)
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.Hull.Durability -= hullDamage;
|
|
|
|
|
|
entity.HullDamage.OnNext(hullDamage);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var collider in HullColliders)
|
|
|
|
|
|
{
|
|
|
|
|
|
collider.Splash.Subscribe(splash =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var hitShape = new Shape(hullData.Shape.Width, hullData.Shape.Height);
|
|
|
|
|
|
foreach (var v in hullData.Shape.Coordinates)
|
|
|
|
|
|
{
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
var localHitDirection = transform.InverseTransformDirection(splash.Direction.ToUnity());
|
2026-08-10 14:57:50 +01:00
|
|
|
|
var direction = normalize(float2(localHitDirection.x, localHitDirection.z));
|
|
|
|
|
|
var cellDot = dot(normalize(v - hullData.Shape.CenterOfMass), direction);
|
|
|
|
|
|
if (cellDot < 0) hitShape[v] = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
DamageSchematic(splash.Damage, hitShape);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
collider.Hit.Subscribe(hit =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Entity.IncomingHit.OnNext(hit.Source);
|
|
|
|
|
|
var hardpointIndex = (int) hit.TexCoord.x - 1;
|
|
|
|
|
|
|
|
|
|
|
|
var hitShape = new Shape(hullData.Shape.Width, hullData.Shape.Height);
|
|
|
|
|
|
|
|
|
|
|
|
// U coordinate between 0-1 indicates a hit that didn't land directly on a hardpoint
|
|
|
|
|
|
// Find the 2D position of the hit scaled to the schematic
|
|
|
|
|
|
float2 hitPos = float2.zero;
|
|
|
|
|
|
if (hardpointIndex < 0 || hardpointIndex >= hullData.Hardpoints.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
hitPos = float2(hit.TexCoord.x * hullData.Shape.Width, hit.TexCoord.y * hullData.Shape.Height);
|
|
|
|
|
|
// Search all schematic border cells for the cell which is closest to the hit position
|
|
|
|
|
|
var hitCell = int2(-1);
|
|
|
|
|
|
var distance = float.MaxValue;
|
|
|
|
|
|
foreach (var v in hullData.Shape.Coordinates)
|
|
|
|
|
|
{
|
|
|
|
|
|
var cellDist = lengthsq(hitPos - v);
|
|
|
|
|
|
if (cellDist < distance)
|
|
|
|
|
|
{
|
|
|
|
|
|
distance = cellDist;
|
|
|
|
|
|
hitCell = v;
|
|
|
|
|
|
hitPos = v + float2(.5f);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
hitShape[hitCell] = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Collider UV coordinates starting with 1 correspond to hardpoint index
|
|
|
|
|
|
var hardpoint = hullData.Hardpoints[hardpointIndex];
|
|
|
|
|
|
|
|
|
|
|
|
// Obtain the hull coordinates of all cells occupied by the hardpoint
|
|
|
|
|
|
var hardpointCells = hullData.Shape.Inset(hardpoint.Shape, hardpoint.Position);
|
|
|
|
|
|
hitPos = hardpointCells.CenterOfMass;
|
|
|
|
|
|
foreach (var v in hardpointCells.Coordinates)
|
|
|
|
|
|
hitShape[v] = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Mathf.RoundToInt(hit.Spread); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
hitShape = hitShape.Expand();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hit.Penetration > .5f)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Find the local 2D vector corresponding to the direction of the incoming hit
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
var localHitDirection = transform.InverseTransformDirection(hit.Direction.ToUnity());
|
2026-08-10 14:57:50 +01:00
|
|
|
|
var penetrationVector = normalize(float2(localHitDirection.x, localHitDirection.z));
|
|
|
|
|
|
// TODO: Bresenham's line algorithm
|
|
|
|
|
|
// March a ray through the ship from the hit position
|
|
|
|
|
|
var penetrationPoint = hitPos;
|
|
|
|
|
|
var penetrationDistance = 0f;
|
|
|
|
|
|
while (penetrationDistance < hit.Penetration && hullData.Shape[int2(penetrationPoint)])
|
|
|
|
|
|
{
|
|
|
|
|
|
penetrationDistance += .5f;
|
|
|
|
|
|
hitShape[int2(penetrationPoint)] = true;
|
|
|
|
|
|
penetrationPoint += penetrationVector * .5f;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DamageSchematic(hit.Damage, hitShape);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-26 19:01:47 +00:00
|
|
|
|
LookAtPoint = new GameObject($"{entity.Name} Look Point").transform;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var articulationPoint in ArticulationPoints)
|
|
|
|
|
|
{
|
|
|
|
|
|
articulationPoint.Target = LookAtPoint;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
_subscriptions.Add(Entity.HullDamage.Subscribe(_ =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Entity.Hull.Durability < .01f)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!this) return;
|
|
|
|
|
|
_destroyed = true;
|
|
|
|
|
|
foreach (var gear in Entity.Equipment)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (gear != Entity.EquippedHull && Random.value < ZoneRenderer.Settings.LootDropProbability)
|
|
|
|
|
|
{
|
|
|
|
|
|
ZoneRenderer.DropItem(
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
Entity.Position.ToUnity(),
|
2026-08-10 14:57:50 +01:00
|
|
|
|
Random.onUnitSphere * ZoneRenderer.Settings.LootDropVelocity,
|
|
|
|
|
|
gear.EquippableItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var cargo in Entity.CargoBays)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in cargo.Cargo.Keys)
|
|
|
|
|
|
{
|
|
|
|
|
|
ZoneRenderer.DropItem(
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
Entity.Position.ToUnity(),
|
2026-08-10 14:57:50 +01:00
|
|
|
|
Random.onUnitSphere * ZoneRenderer.Settings.LootDropVelocity,
|
|
|
|
|
|
item);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (DestroyEffect != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var t = Instantiate(DestroyEffect).transform;
|
|
|
|
|
|
t.position = transform.position;
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.Zone.Entities.Remove(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
2021-05-11 04:45:42 +01:00
|
|
|
|
if (entity is OrbitalEntity orbital && orbital.IsSecureArea)
|
2021-05-02 20:59:45 +01:00
|
|
|
|
{
|
|
|
|
|
|
_influenceInstance = Instantiate(InfluencePrefab);
|
|
|
|
|
|
_influenceInstance.transform.localScale = Vector3.one * orbital.SecurityRadius;
|
|
|
|
|
|
}
|
2021-02-26 19:01:47 +00:00
|
|
|
|
}
|
2022-08-08 22:43:55 +01:00
|
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
|
private void OnSensorPingEnd()
|
|
|
|
|
|
{
|
|
|
|
|
|
Destroy(_currentPing.transform.gameObject);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-26 19:01:47 +00:00
|
|
|
|
public Transform GetBarrel(HardpointData hardpoint)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Barrels.ContainsKey(hardpoint))
|
|
|
|
|
|
{
|
|
|
|
|
|
var barrel = Barrels[hardpoint][BarrelIndices[hardpoint]];
|
|
|
|
|
|
BarrelIndices[hardpoint] = (BarrelIndices[hardpoint] + 1) % Barrels[hardpoint].Length;
|
|
|
|
|
|
return barrel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return transform;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Update()
|
|
|
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
|
if (_currentPing.transform)
|
|
|
|
|
|
{
|
|
|
|
|
|
_currentPing.transform.localScale = _sensor.PingRadius * Vector3.one;
|
|
|
|
|
|
_currentPing.meshRenderer.material.SetFloat("_Depth", _pingBrightness * _sensor.PingBrightness);
|
|
|
|
|
|
}
|
2021-02-26 19:01:47 +00:00
|
|
|
|
if (_fading)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_fadingIn)
|
|
|
|
|
|
{
|
|
|
|
|
|
_fade += Time.deltaTime / _fadeTime;
|
|
|
|
|
|
if (!_fadedElementsVisible && _fade > .01f)
|
|
|
|
|
|
{
|
|
|
|
|
|
_fadedElementsVisible = true;
|
|
|
|
|
|
foreach (var mesh in _meshes.Keys) mesh.enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (_fade > 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
_fade = 1;
|
|
|
|
|
|
_fading = false;
|
|
|
|
|
|
OnFadedIn?.Invoke();
|
|
|
|
|
|
OnFadedIn = null;
|
|
|
|
|
|
ShowUnfadedElements();
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach(var material in _fadeMaterials) material.SetFloat("_Fade", _fade);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
_fade -= Time.deltaTime / _fadeTime;
|
|
|
|
|
|
if(_unfadedElementsVisible && _fade < .99f) HideUnfadedElements();
|
|
|
|
|
|
if (_fade < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
_fadedElementsVisible = false;
|
|
|
|
|
|
foreach (var mesh in _meshes.Keys) mesh.enabled = false;
|
|
|
|
|
|
_fade = 0;
|
|
|
|
|
|
_fading = false;
|
|
|
|
|
|
OnFadedOut?.Invoke();
|
|
|
|
|
|
OnFadedOut = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach(var material in _fadeMaterials) material.SetFloat("_Fade", _fade);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var x in RadiatorMeshes)
|
|
|
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
|
x.Value.material.SetFloat("_Emission", Entity.ItemManager.GameplaySettings.TemperatureEmissionCurve.Evaluate(x.Key.RadiatorTemperature));
|
2021-02-26 19:01:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var x in Barrels)
|
|
|
|
|
|
{
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
Entity.HardpointTransforms[x.Key] = (x.Value[0].position.ToCultMath(), x.Value[0].forward.ToCultMath());
|
2021-02-26 19:01:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
LookAtPoint.position = transform.position + Entity.LookDirection.ToUnity() *
|
2026-08-10 14:57:50 +01:00
|
|
|
|
(Entity.Target.Value != null ? max(Entity.TargetRange,Entity.ItemManager.GameplaySettings.ConvergenceMinimumDistance) : 10000);
|
Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or
Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at
each engine boundary: FieldDriver, GuidedProjectile(Manager),
EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance,
ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace,
MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math
calls that were handed Unity vectors now take converted values;
Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's
Vector3.Dot on float3s becomes dot. packages-lock.json records the
cultmath git package at f0605367 and demotes com.unity.mathematics to a
transitive dependency.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:47:33 +02:00
|
|
|
|
LocalSpace.localPosition = transform.position = Entity.Position.ToUnity();
|
2021-05-02 20:59:45 +01:00
|
|
|
|
if (_influenceInstance)
|
2026-08-10 14:57:50 +01:00
|
|
|
|
_influenceInstance.position = new Vector3(Entity.Position.x, 0, Entity.Position.z);
|
2021-02-26 19:01:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-03-16 16:35:23 +00:00
|
|
|
|
public virtual void OnDestroy()
|
2021-02-26 19:01:47 +00:00
|
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
|
if(_sensor!=null)
|
|
|
|
|
|
_sensor.OnPingEnd -= OnSensorPingEnd;
|
2021-05-02 20:59:45 +01:00
|
|
|
|
if (_influenceInstance) Destroy(_influenceInstance.gameObject);
|
2021-04-15 04:25:22 +01:00
|
|
|
|
Destroy(LocalSpace.gameObject);
|
2021-02-26 19:01:47 +00:00
|
|
|
|
foreach(var x in _subscriptions)
|
|
|
|
|
|
x.Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|