Persist dropped pickups in zone checkpoints
This commit is contained in:
parent
729ab0e8d8
commit
5d5098aae6
11 changed files with 288 additions and 14 deletions
|
|
@ -661,10 +661,38 @@ public class ActionGameManager : MonoBehaviour
|
|||
Bodies = ProjectZoneBodies(zone),
|
||||
Entities = zone.Entities
|
||||
.Select((entity, index) => ProjectEntitySnapshot(zone, entity, index))
|
||||
.ToArray()
|
||||
.ToArray(),
|
||||
DroppedPickups = ProjectDroppedPickups(zone)
|
||||
};
|
||||
}
|
||||
|
||||
private AetheriaRuntimeDroppedPickupCommit[] ProjectDroppedPickups(Zone zone)
|
||||
{
|
||||
if (Zone != zone || ZoneRenderer?.ActiveLoot == null)
|
||||
return Array.Empty<AetheriaRuntimeDroppedPickupCommit>();
|
||||
|
||||
return ZoneRenderer.ActiveLoot
|
||||
.Where(pickup => pickup != null && pickup.Item != null)
|
||||
.Select((pickup, index) =>
|
||||
{
|
||||
var gridObject = pickup.GetComponent<GridObject>();
|
||||
var position = pickup.transform.position;
|
||||
var velocity = gridObject == null ? Vector3.zero : gridObject.Velocity;
|
||||
return new AetheriaRuntimeDroppedPickupCommit
|
||||
{
|
||||
PickupIndex = index,
|
||||
PositionX = position.x,
|
||||
PositionY = position.y,
|
||||
PositionZ = position.z,
|
||||
VelocityX = velocity.x,
|
||||
VelocityY = velocity.y,
|
||||
VelocityZ = velocity.z,
|
||||
Item = ProjectLoadoutItem(pickup.Item)
|
||||
};
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeOrbitSnapshotCommit[] ProjectZoneOrbits(Zone zone)
|
||||
{
|
||||
return zone?.Orbits?.Values
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
private List<ItemPickup> _loot = new List<ItemPickup>();
|
||||
|
||||
public Zone Zone { get; private set; }
|
||||
public IReadOnlyList<ItemPickup> ActiveLoot => _loot;
|
||||
public ItemManager ItemManager { get; set; }
|
||||
|
||||
public Entity PerspectiveEntity
|
||||
|
|
|
|||
Loading…
Reference in a new issue