Added configurable weapons.

This commit is contained in:
2026-01-03 21:49:27 -05:00
parent 79fd63c3ce
commit e8e31bb143
37 changed files with 332 additions and 88 deletions

View File

@@ -1,6 +1,6 @@
namespace AlienAttack.MonoGame.Things.Items;
internal class Ammo : Item
public class Ammo : Item
{
protected override PickupKind Kind => PickupKind.Ammo;
@@ -8,9 +8,4 @@ internal class Ammo : Item
{
TextureName = @$"Sprites\Powerup_Ammo";
}
protected override void ApplyEffect(Player player)
{
}
}

View File

@@ -1,6 +1,6 @@
namespace AlienAttack.MonoGame.Things.Items;
internal class Energy : Item
public class Energy : Item
{
protected override PickupKind Kind => PickupKind.Plasma;
@@ -8,9 +8,4 @@ internal class Energy : Item
{
TextureName = @$"Sprites\Powerup_Energy";
}
protected override void ApplyEffect(Player player)
{
}
}

View File

@@ -1,6 +1,6 @@
namespace AlienAttack.MonoGame.Things.Items;
internal class Health : Item
public class Health : Item
{
protected override PickupKind Kind => PickupKind.Health;
@@ -8,9 +8,4 @@ internal class Health : Item
{
TextureName = @$"Sprites\Powerup_Health";
}
protected override void ApplyEffect(Player player)
{
}
}

View File

@@ -4,7 +4,7 @@ using System;
namespace AlienAttack.MonoGame.Things.Items;
internal abstract class Item : MoveableSprite
public abstract class Item : MoveableSprite
{
private Vector2 _anchor; // the "center" the item orbits around
private float _t; // radians
@@ -59,13 +59,10 @@ internal abstract class Item : MoveableSprite
public override void OnCollision(SpriteCollisionContext context)
{
if (context.Sprite is Player player)
if (context.Sprite is Player)
{
IsDead = true;
ApplyEffect(player);
context.AudioManager.PlayPickup(Kind);
}
}
protected abstract void ApplyEffect(Player player);
}

View File

@@ -1,6 +1,6 @@
namespace AlienAttack.MonoGame.Things.Items;
internal class Rockets : Item
public class Rockets : Item
{
protected override PickupKind Kind => PickupKind.Rockets;
@@ -8,9 +8,4 @@ internal class Rockets : Item
{
TextureName = @$"Sprites\Powerup_Rockets";
}
protected override void ApplyEffect(Player player)
{
}
}

View File

@@ -1,6 +1,6 @@
namespace AlienAttack.MonoGame.Things.Items;
internal class Shields : Item
public class Shields : Item
{
protected override PickupKind Kind => PickupKind.Shield;
@@ -8,9 +8,4 @@ internal class Shields : Item
{
TextureName = @$"Sprites\Powerup_Shields";
}
protected override void ApplyEffect(Player player)
{
}
}