Show / Hide Table of Contents

Class EntityManagerZoned

Manages a set of entities. Adds a render step and only renders the entities that are in the parent IScreenSurface visible area.

Inheritance
object
UpdateComponent
EntityManager
EntityManagerZoned
Implements
IList<Entity>
ICollection<Entity>
IEnumerable<Entity>
IEnumerable
IDisposable
IComponent
Inherited Members
EntityManager.IsAttached
EntityManager._entities
EntityManager._entitiesVisible
EntityManager._screen
EntityManager._offsetAreaPixels
EntityManager._screenCachedView
EntityManager._screenCachedFont
EntityManager._screenCachedFontSize
EntityManager.RenderStep
EntityManager.Add(Entity)
EntityManager.AddRange(IEnumerable<Entity>)
EntityManager.AddEntity(Entity, bool)
EntityManager.RemoveEntity(Entity)
EntityManager.Remove(Entity)
EntityManager.Clear()
EntityManager.OnAdded(IScreenObject)
EntityManager.OnRemoved(IScreenObject)
EntityManager.Update(IScreenObject, TimeSpan)
EntityManager.GetRenderRectangle(Point, bool)
EntityManager.SortVisibleEntities()
EntityManager.CalculateEntityVisibility(Entity)
EntityManager.CalculateEntityVisibilityProtected(Entity, bool)
EntityManager.UpdateCachedVisibilityArea()
EntityManager.IndexOf(Entity)
EntityManager.Contains(Entity)
EntityManager.CopyTo(Entity[], int)
EntityManager.GetEnumerator()
EntityManager.Dispose(bool)
EntityManager.Dispose()
EntityManager.Entities
EntityManager.EntitiesVisible
EntityManager.IsDirty
EntityManager.DoEntityUpdate
EntityManager.SkipExistsChecks
EntityManager.AlternativeFont
EntityManager.Count
EntityManager.IsReadOnly
EntityManager.this[int]
UpdateComponent.SortOrder
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.Entities
Assembly: SadConsole.Extended.dll
Syntax
[DataContract]
public class EntityManagerZoned : EntityManager, IList<Entity>, ICollection<Entity>, IEnumerable<Entity>, IEnumerable, IDisposable, IComponent

Constructors

EntityManagerZoned()

Creates a new manager to handle entity movement within zones.

Declaration
public EntityManagerZoned()

Fields

_zones

The zones in this manager.

Declaration
[DataMember(Name = "Zones")]
protected List<Zone> _zones
Field Value
Type Description
List<Zone>

Properties

Zones

The zones associated with this manager.

Declaration
public IReadOnlyList<Zone> Zones { get; }
Property Value
Type Description
IReadOnlyList<Zone>

Methods

Add(Zone)

Adds a zone to this manager.

Declaration
public void Add(Zone zone)
Parameters
Type Name Description
Zone zone

The zone to add.

Contains(Zone)

Checks if the manager contains the specified zone.

Declaration
public bool Contains(Zone zone)
Parameters
Type Name Description
Zone zone

The zone to check for.

Returns
Type Description
bool

DisableEntity(Entity)

Prevents an entity from being processed with the Zones.

Declaration
public void DisableEntity(Entity entity)
Parameters
Type Name Description
Entity entity

The entity to disable.

EnableEntity(Entity)

Enables the entity to be processed with with the Zones.

Declaration
public void EnableEntity(Entity entity)
Parameters
Type Name Description
Entity entity

The entity to disable.

GetEntitiesAtPosition(Point)

Returns an enumerator containing the entities, if any, at the specified position.

Declaration
public ListEnumerator<Entity> GetEntitiesAtPosition(Point position)
Parameters
Type Name Description
Point position

The position to get an entity at.

Returns
Type Description
ListEnumerator<Entity>

An array of entities if they exist; otherwise null.

GetEntitiesInZone(Zone)

Returns a list of entities that are located in the specified zone.

Declaration
public IReadOnlyList<Entity> GetEntitiesInZone(Zone zone)
Parameters
Type Name Description
Zone zone

The zone to filter entities by.

Returns
Type Description
IReadOnlyList<Entity>

A list of entities.

GetEntityAtPosition(Point)

Returns an entity at the specified position or null if there is no entity. If there are multiple entities at the specified position, only one of them is returned.

Declaration
public Entity? GetEntityAtPosition(Point position)
Parameters
Type Name Description
Point position

The position to get an entity at.

Returns
Type Description
Entity

The entity if it exists; otherwise it returns null.

GetZonesAtPosition(Point)

Returns a collection of zones at the specified position.

Declaration
public Zone[] GetZonesAtPosition(Point position)
Parameters
Type Name Description
Point position

The position to check for zones.

Returns
Type Description
Zone[]

Every zone that contains the position.

GetZonesAtPosition(in Point, out HashSet<Zone>)

Gets the zones that contain the specified position.

Declaration
public bool GetZonesAtPosition(in Point point, out HashSet<Zone> zones)
Parameters
Type Name Description
Point point

The position to check.

HashSet<Zone> zones

The zones that contain this position.

Returns
Type Description
bool

true when at least one zone was found; otherwise false.

HasEntityAt(Point)

Returns true when there is an entity at the specified position; otherwise false.

Declaration
public bool HasEntityAt(Point position)
Parameters
Type Name Description
Point position

The position to check.

Returns
Type Description
bool

A value indicating if an entity exists.

IsEntityDisabled(Entity)

Returns true when the entity has been disabled by DisableEntity(Entity); otherwise false.

Declaration
public bool IsEntityDisabled(Entity entity)
Parameters
Type Name Description
Entity entity

The entity to check.

Returns
Type Description
bool

true when the entity is disabled.

OnEntityAdded(Entity)

Adds entity state information to an entity when it's added.

Declaration
protected override void OnEntityAdded(Entity entity)
Parameters
Type Name Description
Entity entity

The entity that was added.

Overrides
EntityManager.OnEntityAdded(Entity)

OnEntityChangedPosition(Entity, ValueChangedEventArgs<Point>)

Called when an entity changes position.

Declaration
protected override void OnEntityChangedPosition(Entity entity, ValueChangedEventArgs<Point> e)
Parameters
Type Name Description
Entity entity

The entity that moved.

ValueChangedEventArgs<Point> e

The previous and new values of the position.

Overrides
EntityManager.OnEntityChangedPosition(Entity, ValueChangedEventArgs<Point>)

OnEntityEnterZone(IScreenSurface, Zone, Entity, Point)

Called when an entity enters a zone and raises the EnterZone event.

Declaration
protected virtual void OnEntityEnterZone(IScreenSurface host, Zone zone, Entity entity, Point triggeredPosition)
Parameters
Type Name Description
IScreenSurface host

The host that the zone and entity share.

Zone zone

The zone the entity entered.

Entity entity

The entity that entered the zone.

Point triggeredPosition

The position the entity entered.

OnEntityExitZone(IScreenSurface, Zone, Entity, Point)

Called when an entity enters a zone and raises the ExitZone event.

Declaration
protected virtual void OnEntityExitZone(IScreenSurface host, Zone zone, Entity entity, Point triggeredPosition)
Parameters
Type Name Description
IScreenSurface host

The host that the zone and entity share.

Zone zone

The zone the entity exited.

Entity entity

The entity that exited the zone.

Point triggeredPosition

The new position the entity left.

OnEntityMoveZone(IScreenSurface, Zone, Entity, Point, Point)

Called when an entity moves within a zone.

Declaration
protected virtual void OnEntityMoveZone(IScreenSurface host, Zone zone, Entity entity, Point newPosition, Point oldPosition)
Parameters
Type Name Description
IScreenSurface host

The host that the zone and entity share.

Zone zone

The zone the entity moved in.

Entity entity

The entity that moved in the zone.

Point newPosition

The position the entity moved to.

Point oldPosition

The position the entity moved from.

OnEntityRemoved(Entity)

Removes the entity state information of an entity being removed.

Declaration
protected override void OnEntityRemoved(Entity entity)
Parameters
Type Name Description
Entity entity

The entity that was removed.

Overrides
EntityManager.OnEntityRemoved(Entity)

Remove(Zone)

Removes a zone from this manager.

Declaration
public void Remove(Zone zone)
Parameters
Type Name Description
Zone zone

The hotspot to remove.

Events

EnterZone

An event to indicate that an entity entered a zone.

Declaration
public event EventHandler<EntityManagerZoned.ZoneEventArgs>? EnterZone
Event Type
Type Description
EventHandler<EntityManagerZoned.ZoneEventArgs>

ExitZone

An event to indicate that an entity exited a zone.

Declaration
public event EventHandler<EntityManagerZoned.ZoneEventArgs>? ExitZone
Event Type
Type Description
EventHandler<EntityManagerZoned.ZoneEventArgs>

Implements

IList<T>
ICollection<T>
IEnumerable<T>
IEnumerable
IDisposable
IComponent

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX