blob: 4df622566270de0d330d1942f71d14f23b7b5095 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
using Microsoft.Xna.Framework;
using V3.Objects;
namespace V3.AI.Internal
{
/// <summary>
/// Spawns a creature at a given position.
/// </summary>
// ReSharper disable once ClassNeverInstantiated.Global
public class SpawnAction : AbstractAction
{
private readonly IObjectsManager mObjectsManager;
private ICreature mCreature;
private Vector2 mPosition;
/// <summary>
/// Creates a new SpawnAction that spawns the given creature at the
/// given position.
/// </summary>
/// <param name="objectsManager">the linked objects manager</param>
/// <param name="creature">the creature to spawn</param>
/// <param name="position">the spawn position</param>
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;
}
}
}
|