From ced3d03bdb3ce866d832e03fb212865140905a9a Mon Sep 17 00:00:00 2001 From: Thomas Leyh Date: Sun, 24 Jul 2016 08:14:18 +0200 Subject: Add project files. --- V3/AI/Internal/SpawnAction.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 V3/AI/Internal/SpawnAction.cs (limited to 'V3/AI/Internal/SpawnAction.cs') diff --git a/V3/AI/Internal/SpawnAction.cs b/V3/AI/Internal/SpawnAction.cs new file mode 100644 index 0000000..4df6225 --- /dev/null +++ b/V3/AI/Internal/SpawnAction.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using V3.Objects; + +namespace V3.AI.Internal +{ + /// + /// Spawns a creature at a given position. + /// + // ReSharper disable once ClassNeverInstantiated.Global + public class SpawnAction : AbstractAction + { + private readonly IObjectsManager mObjectsManager; + private ICreature mCreature; + private Vector2 mPosition; + + /// + /// Creates a new SpawnAction that spawns the given creature at the + /// given position. + /// + /// the linked objects manager + /// the creature to spawn + /// the spawn position + public SpawnAction(IObjectsManager objectsManager, ICreature creature, Vector2 position) + { + mObjectsManager = objectsManager; + mCreature = creature; + mPosition = position; + } + + public override void Start() + { + mCreature.Position = mPosition; + mObjectsManager.CreateCreature(mCreature); + base.Start(); + } + + protected override ActionState GetNextState() + { + return ActionState.Done; + } + } +} -- cgit v1.2.1