Added more sound effects. Added initial weapon muzzle fire logic.

This commit is contained in:
2026-01-02 00:54:09 -05:00
parent c4a98ce03d
commit df45203227
43 changed files with 459 additions and 30 deletions

View File

@@ -1,15 +1,13 @@
using AlienAttack.MonoGame.Things.Bullets;
using AlienAttack.MonoGame.Things.Enemies;
using AlienAttack.MonoGame.Things.Items;
using AlienAttack.MonoGame.Things.Muzzles;
using AlienAttack.MonoGame.Things.Weapons;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.IO;
using static System.Net.Mime.MediaTypeNames;
namespace AlienAttack.MonoGame.Things;
@@ -52,11 +50,19 @@ internal class Player : MoveableSprite
public int Health { get; protected set; }
public int Shield { get; protected set; }
public IReadOnlyList<Muzzle> Muzzles { get; } =
[
new Muzzle(MuzzleId.Center, new Vector2(31.5f, 1f)),
new Muzzle(MuzzleId.Left, new Vector2(15f, 27f)),
new Muzzle(MuzzleId.Right, new Vector2(47f, 27f)),
];
public Player(int x, int y) : base(x, y)
{
BoundBox = new Rectangle(0, 0, 64, 64);
ActiveWeapons.Add(new Minigun());
//ActiveWeapons.Add(new Minigun());
//ActiveWeapons.Add(new FastMinigun());
ActiveWeapons.Add(new MinigunSpread());
Health = 100;
Shield = 100;
}
@@ -336,10 +342,12 @@ internal class Player : MoveableSprite
{
//SCIEnrg_Shield Activate_01_SFRMS_SCIWPNS
int number = context.Random.Next(1, 6);
//int number = context.Random.Next(1, 6);
SoundEffect soundEffect = context.Content.Load<SoundEffect>(@$"Sfx\Shield\SCIEnrg_Shield Activate_0{number}_SFRMS_SCIWPNS");
soundEffect.Play(0.85f, (float)(context.Random.NextDouble() * 0.1 - 0.05), 0);
//SoundEffect soundEffect = context.Content.Load<SoundEffect>(@$"Sfx\Shield\SCIEnrg_Shield Activate_0{number}_SFRMS_SCIWPNS");
//soundEffect.Play(0.85f, (float)(context.Random.NextDouble() * 0.1 - 0.05), 0);
//context.AudioManager.PlayPickup(PickupKind.Shield);
GiveShield(20);
}