Empeld
Empeld plugin documentation.
essentials.Systems.Triggers.EntityAreaTrigger Class Reference
Inheritance diagram for essentials.Systems.Triggers.EntityAreaTrigger:
essentials.Systems.Triggers.AbstractTrigger essentials.Systems.Triggers.ITrigger

Public Member Functions

 EntityAreaTrigger (Volume volume, Func< IEntity, bool > predicate)
 
 EntityAreaTrigger (Volume volume)
 
- Public Member Functions inherited from essentials.Systems.Triggers.AbstractTrigger
void Listen ()
 
void Dispose ()
 

Protected Member Functions

override bool CheckTrigger ()
 
- Protected Member Functions inherited from essentials.Systems.Triggers.AbstractTrigger
 AbstractTrigger (TimeSpan checkFrequency)
 
 AbstractTrigger ()
 
TaskResult HandleTriggerCheck ()
 

Additional Inherited Members

- Properties inherited from essentials.Systems.Triggers.AbstractTrigger
int TriggerCount [get]
 
Action< ITriggerTriggered
 
- Properties inherited from essentials.Systems.Triggers.ITrigger
int TriggerCount [get]
 
- Events inherited from essentials.Systems.Triggers.ITrigger
Action< ITriggerTriggered
 

Constructor & Destructor Documentation

◆ EntityAreaTrigger() [1/2]

essentials.Systems.Triggers.EntityAreaTrigger.EntityAreaTrigger ( Volume  volume,
Func< IEntity, bool >  predicate 
)
17  {
18  this.InjectDependencies();
19  this._volume = volume;
20  this._predicate = predicate;
21  }

◆ EntityAreaTrigger() [2/2]

essentials.Systems.Triggers.EntityAreaTrigger.EntityAreaTrigger ( Volume  volume)
24  :this(volume, x => true)
25  { }

Member Function Documentation

◆ CheckTrigger()

override bool essentials.Systems.Triggers.EntityAreaTrigger.CheckTrigger ( )
protectedvirtual

Implements essentials.Systems.Triggers.AbstractTrigger.

30  {
31  foreach(var entity in _entityManager.GetEntitiesOfType<IActor>())
32  {
33  if (_volume.PointIn( (Vector3i)entity.Position )
34  && _predicate(entity) )
35  {
36  return true;
37  }
38  }
39  return false;
40  }
A class representing a 3D coordinate of integers
Definition: Vector3i.cs:13
bool PointIn(Vector3i pt)
Definition: Volume.cs:167

The documentation for this class was generated from the following file: