diff --git a/components/InteractionComponent.cs b/components/InteractionComponent.cs
index 3f69fce..1633b6b 100644
--- a/components/InteractionComponent.cs
+++ b/components/InteractionComponent.cs
@@ -10,6 +10,12 @@ public class InteractionComponent: Component
[Signal]
delegate void InteractionEnd(Spatial owningEntity, Spatial targetEntity);
+ public void EndInteraction()
+ {
+ hasStopped = true;
+ }
+
+ public bool hasStopped = false;
public Spatial OwningEntity;
public Spatial TargetEntity;
}
\ No newline at end of file
diff --git a/components/TaskQueueComponent.cs b/components/TaskQueueComponent.cs
index 8a9f4f3..aa110fa 100644
--- a/components/TaskQueueComponent.cs
+++ b/components/TaskQueueComponent.cs
@@ -27,10 +27,8 @@ public class TaskQueueComponent : Component
do
{
var currentTask = Queue.Peek();
- var interactionTask = currentTask as InteractionTask;
- if (interactionTask != null) EmitSignal("StartInteraction", entity, interactionTask.TargetEntity);
- if (currentTask.PerformTask(entity, delta))
+ if (currentTask.PerformTask(entity, this, delta))
Queue.Dequeue();
else
break;
@@ -43,7 +41,7 @@ public class TaskQueueComponent : Component
/// Executes a Task on the specified entity.
///
/// true when the Task is complete, false otherwise
- public abstract bool PerformTask(Entity entity, float delta);
+ public abstract bool PerformTask(Entity entity, TaskQueueComponent taskQueueComponent, float delta);
}
///
@@ -59,7 +57,7 @@ public class TaskQueueComponent : Component
NavigationPoint = navigationPoint;
}
- public override bool PerformTask(Entity entity, float delta)
+ public override bool PerformTask(Entity entity, TaskQueueComponent taskQueueComponent, float delta)
{
return NavigationPoint.IsReached(entity.GlobalTransform);
}
@@ -74,8 +72,10 @@ public class TaskQueueComponent : Component
TargetEntity = entity;
}
- public override bool PerformTask(Entity entity, float delta)
+ public override bool PerformTask(Entity entity, TaskQueueComponent taskQueueComponent, float delta)
{
+ taskQueueComponent.EmitSignal("StartInteraction", entity, TargetEntity);
+
return true;
}
}
diff --git a/scenes/World.cs b/scenes/World.cs
index 8cb460d..abddfd1 100644
--- a/scenes/World.cs
+++ b/scenes/World.cs
@@ -80,6 +80,9 @@ public class World : Spatial
[Signal]
private delegate void OnHeightmapImageChanged(Image heightmapImage);
+ [Signal]
+ public delegate void EntityClicked(Entity entity);
+
public World()
{
Debug.Assert(ChunkSize % 2 == 0);
@@ -500,4 +503,9 @@ public class World : Spatial
State = GenerationState.Done;
}
}
+
+ private void OnEntityClicked(Entity entity)
+ {
+ EmitSignal("EntityClicked", entity);
+ }
}
\ No newline at end of file