mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-26 10:52:35 +00:00
fireballs killing zombies and stuff
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using JamGame.Components;
|
||||
using Microsoft.Xna.Framework;
|
||||
using MonoGame.Extended.Entities;
|
||||
using MonoGame.Extended.Entities.Systems;
|
||||
|
||||
namespace JamGame.Systems
|
||||
{
|
||||
public class CollisionResponseSystem : EntityProcessingSystem
|
||||
{
|
||||
private ComponentMapper<Body> _bodyMapper;
|
||||
|
||||
public CollisionResponseSystem()
|
||||
: base(Aspect.All(typeof(Body)))
|
||||
{
|
||||
}
|
||||
|
||||
public override void Initialize(IComponentMapperService mapperService)
|
||||
{
|
||||
_bodyMapper = mapperService.GetMapper<Body>();
|
||||
}
|
||||
|
||||
public override void Process(GameTime gameTime, int entityId)
|
||||
{
|
||||
var body = _bodyMapper.Get(entityId);
|
||||
|
||||
if (body.IsHit)
|
||||
{
|
||||
var entity = GetEntity(entityId);
|
||||
|
||||
if (entity.Has<Projectile>())
|
||||
entity.Destroy();
|
||||
|
||||
if (entity.Has<Enemy>())
|
||||
entity.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user