Lots of stuff
This commit is contained in:
@@ -12,14 +12,19 @@ namespace EvilSatellites.Objects
|
||||
public class Debris : AbstractGameObject
|
||||
{
|
||||
private ISoundEffect3D Sound;
|
||||
|
||||
private Random rnd = new Random();
|
||||
private Vector3 MovementVector;
|
||||
public Debris(IScreen screen, Vector3 pos) : base(screen)
|
||||
{
|
||||
Type = ObjectType.Debris;
|
||||
Sound = Screen.Manager.Sound.Load3D(@"sfx/debris/1/loop.wav");
|
||||
Sound.Loop = true;
|
||||
Sound.Pitch = 0.9 + (float)rnd.NextDouble()*2;
|
||||
Position = pos;
|
||||
Dimensions = new Vector3(5, 5, 5);
|
||||
Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z);
|
||||
MovementVector = new Vector3(-0.02f + (float)rnd.NextDouble() * 0.01f, -0.02f + (float)rnd.NextDouble() * 0.01f, -0.02f + (float) rnd.NextDouble() * 0.01f);
|
||||
Rotation = Matrix.CreateFromAxisAngle(new Vector3(0, 0, 1), 0);
|
||||
Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||
Activate();
|
||||
}
|
||||
@@ -33,16 +38,29 @@ namespace EvilSatellites.Objects
|
||||
public override void Destroy()
|
||||
{
|
||||
Sound.Destroy();
|
||||
ShouldDestroy = true;
|
||||
Active = false;
|
||||
}
|
||||
|
||||
override public void Update(GameTime gameTime)
|
||||
{
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X, Position.Y, Position.Z);
|
||||
Move(MovementVector);
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2);
|
||||
}
|
||||
|
||||
public override void OnCollision(IGameObject obj)
|
||||
{
|
||||
Sound.Stop();
|
||||
if (obj.Type == ObjectType.Projectile) return;
|
||||
if (obj.Type == ObjectType.Player)
|
||||
{
|
||||
var player = (Player)obj;
|
||||
if (player.Vacuuming)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.TakeDamage(25);
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace EvilSatellites.Objects
|
||||
Generic,
|
||||
Player,
|
||||
Satellite,
|
||||
Projectile
|
||||
Projectile,
|
||||
Debris
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace EvilSatellites.Objects
|
||||
{
|
||||
private Vector3 _PrevPos;
|
||||
private Vector3 MaxSpeed = new Vector3(0.2f, 0.2f, 0.2f);
|
||||
public Vector3 Acceleration = new Vector3(0.008f, 0.008f, 0.008f);
|
||||
public Vector3 Acceleration = new Vector3(0.002wf, 0.004f, 0.004f);
|
||||
private Vector3 Deceleration = new Vector3(0.0025f, 0.0025f, 0.0025f);
|
||||
private ISoundEffect sfxEngine;
|
||||
private ISoundEffect sfxWhine;
|
||||
@@ -22,18 +22,24 @@ namespace EvilSatellites.Objects
|
||||
public IWeapon CurrentWeapon;
|
||||
private int Turning;
|
||||
private int Elevating;
|
||||
public bool Vacuuming;
|
||||
public float Health;
|
||||
private Random rnd = new Random();
|
||||
public Player(IScreen screen): base(screen)
|
||||
{
|
||||
ShouldDestroy = false;
|
||||
Active = true;
|
||||
Type = ObjectType.Player;
|
||||
Position = new Vector3(0, 0, 0);
|
||||
Position = new Vector3(5000, 5000, 4990);
|
||||
Dimensions = new Vector3(5, 5, 5);
|
||||
Movement = new Vector3(0, 0, 0);
|
||||
Rotation = Matrix.Identity;
|
||||
Orientation = Rotation.Forward;
|
||||
CurrentWeapon = new LaserMG(this, (GameScreen)Screen);
|
||||
Turning = 0;
|
||||
Elevating = 0;
|
||||
Vacuuming = false;
|
||||
Health = 100;
|
||||
Activate();
|
||||
}
|
||||
|
||||
@@ -144,5 +150,35 @@ namespace EvilSatellites.Objects
|
||||
Elevating = 0;
|
||||
sfxElevator.Stop();
|
||||
}
|
||||
|
||||
public void StartVacuuming(GameTime time)
|
||||
{
|
||||
Vacuuming = true;
|
||||
sfxVacuum.Start(time);
|
||||
}
|
||||
|
||||
public void StopVacuuming()
|
||||
{
|
||||
Vacuuming = false;
|
||||
sfxVacuum.Stop();
|
||||
}
|
||||
|
||||
public void TakeDamage(float dmg)
|
||||
{
|
||||
Health -= dmg;
|
||||
string dmgSound = @"sfx/physics/collisions/";
|
||||
if (dmg > 60)
|
||||
{
|
||||
dmgSound += "heavy";
|
||||
} else if (dmg > 30)
|
||||
{
|
||||
dmgSound += "medium";
|
||||
} else
|
||||
{
|
||||
dmgSound += "light";
|
||||
}
|
||||
dmgSound += "/int/" + (rnd.Next(2)+1).ToString()+".wav";
|
||||
Screen.Manager.Sound.PlayOneshot(dmgSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,16 @@ namespace EvilSatellites.Objects
|
||||
{
|
||||
ShouldDestroy = false;
|
||||
Active = true;
|
||||
Sound = Screen.Manager.Sound.Load3D(@"sfx/bullets/1.wav");
|
||||
Sound.Loop = true;
|
||||
Sound.Play();
|
||||
Sound.Pitch = 0.9 + rnd.NextDouble()*0.3;
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2);
|
||||
}
|
||||
public override void Destroy()
|
||||
{
|
||||
Sound.Stop();
|
||||
Sound.Destroy();
|
||||
ShouldDestroy = true;
|
||||
Active = false;
|
||||
}
|
||||
@@ -46,13 +53,13 @@ namespace EvilSatellites.Objects
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X + Dimensions.X / 2, Position.Y + Dimensions.Y / 2, Position.Z + Dimensions.Z / 2);
|
||||
}
|
||||
|
||||
public override void OnCollision(IGameObject obj)
|
||||
{
|
||||
if (obj.Type == ObjectType.Projectile) return;
|
||||
if (obj.Type == ObjectType.Player) return;
|
||||
Screen.Manager.Sound.PlayOneshot(@"sfx/physics/impacts/bullet/"+(rnd.Next(5)+1)+".wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z), Screen.Manager.EnvironmentEffect);
|
||||
if (obj.Type == ObjectType.Projectile || obj.Type == ObjectType.Player || obj.Type == ObjectType.Debris) return;
|
||||
Screen.Manager.Sound.PlayOneshot(@"sfx/physics/impacts/bullet/"+(rnd.Next(5)+1)+".wav", new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2), Screen.Manager.EnvironmentEffect);
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,20 @@ namespace EvilSatellites.Objects
|
||||
private int Health;
|
||||
private int SatelliteID;
|
||||
private Random rnd = new Random();
|
||||
private Matrix FlightPath;
|
||||
public Satellite(IScreen screen, Vector3 pos, int satelliteID = 1) : base(screen)
|
||||
{
|
||||
Type = ObjectType.Satellite;
|
||||
SatelliteID = satelliteID;
|
||||
Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/"+SatelliteID.ToString()+"/loop.wav");
|
||||
Sound.Loop = true;
|
||||
Sound.Pitch = 0.9 + rnd.NextDouble()*0.5;
|
||||
Position = pos;
|
||||
Dimensions = new Vector3(5, 5, 5);
|
||||
Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z);
|
||||
Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||
FlightPath = Matrix.CreateFromAxisAngle(Rotation.Right, (float)rnd.NextDouble()*0.1f);
|
||||
Rotation = FlightPath;
|
||||
Activate();
|
||||
}
|
||||
|
||||
@@ -44,12 +48,19 @@ namespace EvilSatellites.Objects
|
||||
|
||||
override public void Update(GameTime gameTime)
|
||||
{
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X, Position.Y, Position.Z);
|
||||
Move(new Vector3(0, 0, -0.05f));
|
||||
Sound.Position = new System.Numerics.Vector3(Position.X+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2);
|
||||
}
|
||||
|
||||
public override void OnCollision(IGameObject obj)
|
||||
{
|
||||
Health -= 10;
|
||||
if (obj.Type == ObjectType.Player)
|
||||
{
|
||||
var player = (Player)obj;
|
||||
player.TakeDamage(66);
|
||||
Destroy();
|
||||
}
|
||||
if (Health <= 0)
|
||||
{
|
||||
Screen.Manager.Sound.PlayOneshot(@"sfx/satellite/"+SatelliteID.ToString()+"/explode.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z));
|
||||
|
||||
Reference in New Issue
Block a user