25 lines
657 B
C#
25 lines
657 B
C#
using Encompass;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using PongFE.Components;
|
|
using PongFE.Messages;
|
|
|
|
namespace PongFE.Spawners
|
|
{
|
|
public class BallSpawner : Spawner<BallSpawnMessage>
|
|
{
|
|
private Texture2D BallTexture { get; }
|
|
|
|
public BallSpawner(Texture2D ballTexture)
|
|
{
|
|
BallTexture = ballTexture;
|
|
}
|
|
|
|
protected override void Spawn(BallSpawnMessage message)
|
|
{
|
|
var ball = CreateEntity();
|
|
AddComponent(ball, new PositionComponent(new MoonTools.Structs.Position2D(640, 360)));
|
|
AddComponent(ball, new Texture2DComponent(BallTexture, 0));
|
|
}
|
|
}
|
|
}
|