Key rendered entity views by daemon index
This commit is contained in:
parent
142e1db6a9
commit
75bb1dabbf
5 changed files with 52 additions and 17 deletions
|
|
@ -3093,7 +3093,13 @@ public class ActionGameManager : MonoBehaviour
|
|||
DockCamera.enabled = true;
|
||||
FollowCamera.enabled = false;
|
||||
var orbital = (OrbitalEntity) entity;
|
||||
DockCamera.Follow = ZoneRenderer.EntityInstances[orbital].transform;
|
||||
if (!ZoneRenderer.TryGetEntityInstance(orbital, out var orbitalInstance))
|
||||
{
|
||||
Debug.LogError($"Attempted to dock at entity {entity.Name}, but ZoneRenderer has no daemon-indexed instance.");
|
||||
return;
|
||||
}
|
||||
|
||||
DockCamera.Follow = orbitalInstance.transform;
|
||||
var parentOrbitKey = Zone.TryGetOrbit(orbital.OrbitKey, out var orbit) ? orbit.ParentOrbitKey : "";
|
||||
var daemonZone = FindCurrentDaemonZoneSnapshot();
|
||||
var parentOrbitPlanetBodyKey = (daemonZone?.Bodies ?? Array.Empty<AetheriaRuntimeBodySnapshotCommit>())
|
||||
|
|
@ -3178,9 +3184,9 @@ public class ActionGameManager : MonoBehaviour
|
|||
Entity entity,
|
||||
IReadOnlyList<AetheriaRuntimeActionBarBindingCommit> actionBarBindings = null)
|
||||
{
|
||||
if (!ZoneRenderer.EntityInstances.ContainsKey(entity))
|
||||
if (!ZoneRenderer.TryGetEntityInstance(entity, out var entityInstance))
|
||||
{
|
||||
Debug.LogError($"Attempted to bind to entity {entity.Name}, but SectorRenderer has no such instance!");
|
||||
Debug.LogError($"Attempted to bind to entity {entity.Name}, but ZoneRenderer has no daemon-indexed instance.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3204,17 +3210,17 @@ public class ActionGameManager : MonoBehaviour
|
|||
ShipPanel.Display(CurrentEntity, true);
|
||||
SchematicDisplay.ShowShip(CurrentEntity);
|
||||
|
||||
FollowCamera.LookAt = ZoneRenderer.EntityInstances[CurrentEntity].LookAtPoint;
|
||||
FollowCamera.Follow = ZoneRenderer.EntityInstances[CurrentEntity].transform;
|
||||
FollowCamera.LookAt = entityInstance.LookAtPoint;
|
||||
FollowCamera.Follow = entityInstance.transform;
|
||||
_articulationGroups = CurrentEntity.Equipment
|
||||
.Where(HasArticulatedWeaponBehavior)
|
||||
.GroupBy(item => ZoneRenderer.EntityInstances[CurrentEntity]
|
||||
.GroupBy(item => entityInstance
|
||||
.GetBarrel(CurrentEntity.Hardpoints[item.Position.x, item.Position.y])
|
||||
.GetComponentInParent<ArticulationPoint>()?.Group ?? -1)
|
||||
.Select((group, index) => {
|
||||
return (
|
||||
group.Select(item => CurrentEntity.Hardpoints[item.Position.x, item.Position.y]).ToArray(),
|
||||
group.Select(item => ZoneRenderer.EntityInstances[CurrentEntity].GetBarrel(CurrentEntity.Hardpoints[item.Position.x, item.Position.y])).ToArray(),
|
||||
group.Select(item => entityInstance.GetBarrel(CurrentEntity.Hardpoints[item.Position.x, item.Position.y])).ToArray(),
|
||||
Crosshairs[index]
|
||||
);
|
||||
}).ToArray();
|
||||
|
|
@ -3974,7 +3980,10 @@ public class ActionGameManager : MonoBehaviour
|
|||
{
|
||||
if (CurrentEntity == null || CurrentEntity.Parent != null) return;
|
||||
|
||||
ViewDot.Target = ZoneRenderer.EntityInstances[CurrentEntity].LookAtPoint.position;
|
||||
if (!ZoneRenderer.TryGetEntityInstance(CurrentEntity, out var entityInstance))
|
||||
return;
|
||||
|
||||
ViewDot.Target = entityInstance.LookAtPoint.position;
|
||||
if (CurrentEntity.Target.Value != null)
|
||||
TargetIndicator.Target = CurrentEntity.Target.Value.Position;
|
||||
var distance = CultMath.math.length(AetheriaMath.ToCult((float3)ViewDot.Target) - CurrentEntity.CultPosition);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class EntityInstance : MonoBehaviour
|
|||
public Dictionary<HardpointData, int> BarrelIndices { get; private set; }
|
||||
public Dictionary<Radiator, MeshRenderer> RadiatorMeshes { get; private set; }
|
||||
public Transform LookAtPoint { get; private set; }
|
||||
public int DaemonEntityIndex { get; private set; } = -1;
|
||||
public Entity Entity { get; private set; }
|
||||
public ZoneRenderer ZoneRenderer { get; private set; }
|
||||
public Transform LocalSpace { get; private set; }
|
||||
|
|
@ -153,6 +154,7 @@ public class EntityInstance : MonoBehaviour
|
|||
LocalSpace.gameObject.name = $"{entity.Name} Sim Space";
|
||||
LocalSpace.SetParent(transform.parent);
|
||||
Entity = entity;
|
||||
DaemonEntityIndex = entity.DaemonEntityIndex;
|
||||
ZoneRenderer = zoneRenderer;
|
||||
var typedHull = FindTypedHull(entity.Hull);
|
||||
if (typedHull == null || typedHull.ShapeWidth <= 0 || typedHull.ShapeHeight <= 0 || typedHull.ShapeCells.Count == 0)
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ public sealed class AetheriaYmirPhysicsBridge : MonoBehaviour
|
|||
{
|
||||
_zoneBodies.Clear();
|
||||
var entityIndex = 0;
|
||||
foreach (var entityInstance in zoneRenderer.EntityInstances.Values)
|
||||
foreach (var entityInstance in zoneRenderer.DaemonEntityInstances.Values)
|
||||
{
|
||||
if (entityInstance == null || entityInstance.Entity == sourceEntity)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in a new issue