57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Encompass
|
|
{
|
|
internal class EntityTracker
|
|
{
|
|
private HashSet<Guid> trackedEntityIDs = new HashSet<Guid>();
|
|
private HashSet<Guid> deactivatedEntityIDs = new HashSet<Guid>();
|
|
|
|
public IEnumerable<Guid> TrackedEntityIDs
|
|
{
|
|
get { return trackedEntityIDs; }
|
|
}
|
|
|
|
public IEnumerable<Guid> DeactivatedEntityIds
|
|
{
|
|
get { return deactivatedEntityIDs; }
|
|
}
|
|
|
|
public void TrackEntity(Guid entityID)
|
|
{
|
|
trackedEntityIDs.Add(entityID);
|
|
}
|
|
|
|
public void UntrackEntity(Guid entityID)
|
|
{
|
|
if (trackedEntityIDs.Remove(entityID))
|
|
{
|
|
deactivatedEntityIDs.Remove(entityID);
|
|
}
|
|
}
|
|
|
|
public void ActivateEntity(Guid entityID)
|
|
{
|
|
if (deactivatedEntityIDs.Remove(entityID))
|
|
{
|
|
trackedEntityIDs.Add(entityID);
|
|
}
|
|
}
|
|
|
|
public void DeactivateEntity(Guid entityID)
|
|
{
|
|
if (trackedEntityIDs.Remove(entityID))
|
|
{
|
|
deactivatedEntityIDs.Add(entityID);
|
|
}
|
|
}
|
|
|
|
public bool IsTracking(Guid entityID)
|
|
{
|
|
return trackedEntityIDs.Contains(entityID);
|
|
}
|
|
}
|
|
}
|