Raise PathComplete event from IMobEntity
...when the current path is completed
This commit is contained in:
parent
19e52bda45
commit
f927f86d43
@ -5,6 +5,7 @@ namespace TrueCraft.API.Entities
|
||||
{
|
||||
public interface IMobEntity : IEntity, IAABBEntity
|
||||
{
|
||||
event EventHandler PathComplete;
|
||||
PathResult CurrentPath { get; set; }
|
||||
bool AdvancePath(TimeSpan time, bool faceRoute = true);
|
||||
void Face(Vector3 target);
|
||||
|
@ -19,6 +19,8 @@ namespace TrueCraft.Core.Entities
|
||||
CurrentState = new WanderState();
|
||||
}
|
||||
|
||||
public event EventHandler PathComplete;
|
||||
|
||||
public override IPacket SpawnPacket
|
||||
{
|
||||
get
|
||||
@ -124,7 +126,9 @@ namespace TrueCraft.Core.Entities
|
||||
CurrentPath.Index++;
|
||||
if (CurrentPath.Index >= CurrentPath.Waypoints.Count)
|
||||
{
|
||||
CurrentPath = null; // TODO: Raise path complete event or something?
|
||||
CurrentPath = null;
|
||||
if (PathComplete != null)
|
||||
PathComplete(this, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user