Derive available entities from observed daemon state
This commit is contained in:
parent
05146a6768
commit
2175cbdd1f
4 changed files with 23 additions and 14 deletions
|
|
@ -3479,20 +3479,23 @@ public class ActionGameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Entity> AvailableEntities()
|
||||
public IEnumerable<Entity> ObservedAvailableEntities()
|
||||
{
|
||||
if (DockedEntity != null && TryGetDaemonEntitySnapshot(DockedEntity, out var dockedEntitySnapshot))
|
||||
if (!TryGetObservedCurrentEntity(out var currentEntity))
|
||||
yield break;
|
||||
|
||||
if (TryGetDaemonParentSnapshot(currentEntity, out var parentSnapshot, out _))
|
||||
{
|
||||
foreach (var childEntityIndex in dockedEntitySnapshot.ChildEntityIndices ?? Array.Empty<int>())
|
||||
foreach (var childEntityIndex in parentSnapshot.ChildEntityIndices ?? Array.Empty<int>())
|
||||
{
|
||||
if (TryGetObservedEntityFacade(childEntityIndex, out var entity) &&
|
||||
entity is Ship { IsPlayerShip: true })
|
||||
yield return entity;
|
||||
}
|
||||
}
|
||||
else if (CurrentEntity != null)
|
||||
else
|
||||
{
|
||||
yield return CurrentEntity;
|
||||
yield return currentEntity;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue