Persist entity contact state in typed snapshots
This commit is contained in:
parent
cb9c5ca21f
commit
1f8a1576f8
10 changed files with 160 additions and 4 deletions
|
|
@ -787,6 +787,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
.ToArray() ?? Array.Empty<int>(),
|
||||
Visibility = entity.Visibility,
|
||||
VisibilitySourceCount = entity.VisibilitySources.Count,
|
||||
Contacts = ProjectEntityContacts(zone, entity),
|
||||
ChildEntityIndices = entity.Children?
|
||||
.Select(child => zone.Entities.IndexOf(child))
|
||||
.Where(index => index >= 0)
|
||||
|
|
@ -802,6 +803,25 @@ public class ActionGameManager : MonoBehaviour
|
|||
};
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeEntityContactCommit[] ProjectEntityContacts(Zone zone, Entity entity)
|
||||
{
|
||||
return entity.EntityInfoGathered
|
||||
.Select(contact =>
|
||||
{
|
||||
var targetIndex = zone.Entities.IndexOf(contact.Key);
|
||||
entity.EntityHostility.TryGetValue(contact.Key, out var hostile);
|
||||
return new AetheriaRuntimeEntityContactCommit
|
||||
{
|
||||
TargetEntityIndex = targetIndex,
|
||||
InfoGathered = contact.Value,
|
||||
Hostile = hostile,
|
||||
Visible = entity.VisibleEntities.Contains(contact.Key)
|
||||
};
|
||||
})
|
||||
.Where(contact => contact.TargetEntityIndex >= 0)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCargoBayLoadoutCommit[] ProjectRuntimeCargoBays<TBay>(IEnumerable<TBay> bays)
|
||||
where TBay : EquippedCargoBay
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue