Lots of stuff
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -12,14 +12,19 @@ namespace EvilSatellites.Objects
|
|||||||
public class Debris : AbstractGameObject
|
public class Debris : AbstractGameObject
|
||||||
{
|
{
|
||||||
private ISoundEffect3D Sound;
|
private ISoundEffect3D Sound;
|
||||||
|
private Random rnd = new Random();
|
||||||
|
private Vector3 MovementVector;
|
||||||
public Debris(IScreen screen, Vector3 pos) : base(screen)
|
public Debris(IScreen screen, Vector3 pos) : base(screen)
|
||||||
{
|
{
|
||||||
|
Type = ObjectType.Debris;
|
||||||
Sound = Screen.Manager.Sound.Load3D(@"sfx/debris/1/loop.wav");
|
Sound = Screen.Manager.Sound.Load3D(@"sfx/debris/1/loop.wav");
|
||||||
Sound.Loop = true;
|
Sound.Loop = true;
|
||||||
|
Sound.Pitch = 0.9 + (float)rnd.NextDouble()*2;
|
||||||
Position = pos;
|
Position = pos;
|
||||||
Dimensions = new Vector3(5, 5, 5);
|
Dimensions = new Vector3(5, 5, 5);
|
||||||
Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z);
|
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);
|
Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
Activate();
|
Activate();
|
||||||
}
|
}
|
||||||
@@ -33,16 +38,29 @@ namespace EvilSatellites.Objects
|
|||||||
public override void Destroy()
|
public override void Destroy()
|
||||||
{
|
{
|
||||||
Sound.Destroy();
|
Sound.Destroy();
|
||||||
|
ShouldDestroy = true;
|
||||||
|
Active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public void Update(GameTime gameTime)
|
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)
|
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,
|
Generic,
|
||||||
Player,
|
Player,
|
||||||
Satellite,
|
Satellite,
|
||||||
Projectile
|
Projectile,
|
||||||
|
Debris
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace EvilSatellites.Objects
|
|||||||
{
|
{
|
||||||
private Vector3 _PrevPos;
|
private Vector3 _PrevPos;
|
||||||
private Vector3 MaxSpeed = new Vector3(0.2f, 0.2f, 0.2f);
|
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 Vector3 Deceleration = new Vector3(0.0025f, 0.0025f, 0.0025f);
|
||||||
private ISoundEffect sfxEngine;
|
private ISoundEffect sfxEngine;
|
||||||
private ISoundEffect sfxWhine;
|
private ISoundEffect sfxWhine;
|
||||||
@@ -22,18 +22,24 @@ namespace EvilSatellites.Objects
|
|||||||
public IWeapon CurrentWeapon;
|
public IWeapon CurrentWeapon;
|
||||||
private int Turning;
|
private int Turning;
|
||||||
private int Elevating;
|
private int Elevating;
|
||||||
|
public bool Vacuuming;
|
||||||
|
public float Health;
|
||||||
|
private Random rnd = new Random();
|
||||||
public Player(IScreen screen): base(screen)
|
public Player(IScreen screen): base(screen)
|
||||||
{
|
{
|
||||||
ShouldDestroy = false;
|
ShouldDestroy = false;
|
||||||
Active = true;
|
Active = true;
|
||||||
Type = ObjectType.Player;
|
Type = ObjectType.Player;
|
||||||
Position = new Vector3(0, 0, 0);
|
Position = new Vector3(5000, 5000, 4990);
|
||||||
Dimensions = new Vector3(5, 5, 5);
|
Dimensions = new Vector3(5, 5, 5);
|
||||||
Movement = new Vector3(0, 0, 0);
|
Movement = new Vector3(0, 0, 0);
|
||||||
Rotation = Matrix.Identity;
|
Rotation = Matrix.Identity;
|
||||||
Orientation = Rotation.Forward;
|
Orientation = Rotation.Forward;
|
||||||
CurrentWeapon = new LaserMG(this, (GameScreen)Screen);
|
CurrentWeapon = new LaserMG(this, (GameScreen)Screen);
|
||||||
Turning = 0;
|
Turning = 0;
|
||||||
|
Elevating = 0;
|
||||||
|
Vacuuming = false;
|
||||||
|
Health = 100;
|
||||||
Activate();
|
Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,5 +150,35 @@ namespace EvilSatellites.Objects
|
|||||||
Elevating = 0;
|
Elevating = 0;
|
||||||
sfxElevator.Stop();
|
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;
|
ShouldDestroy = false;
|
||||||
Active = true;
|
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()
|
public override void Destroy()
|
||||||
{
|
{
|
||||||
|
Sound.Stop();
|
||||||
|
Sound.Destroy();
|
||||||
ShouldDestroy = true;
|
ShouldDestroy = true;
|
||||||
Active = false;
|
Active = false;
|
||||||
}
|
}
|
||||||
@@ -46,13 +53,13 @@ namespace EvilSatellites.Objects
|
|||||||
{
|
{
|
||||||
Destroy();
|
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)
|
public override void OnCollision(IGameObject obj)
|
||||||
{
|
{
|
||||||
if (obj.Type == ObjectType.Projectile) return;
|
if (obj.Type == ObjectType.Projectile || obj.Type == ObjectType.Player || obj.Type == ObjectType.Debris) 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+Dimensions.X/2, Position.Y+Dimensions.Y/2, Position.Z+Dimensions.Z/2), Screen.Manager.EnvironmentEffect);
|
||||||
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);
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,20 @@ namespace EvilSatellites.Objects
|
|||||||
private int Health;
|
private int Health;
|
||||||
private int SatelliteID;
|
private int SatelliteID;
|
||||||
private Random rnd = new Random();
|
private Random rnd = new Random();
|
||||||
|
private Matrix FlightPath;
|
||||||
public Satellite(IScreen screen, Vector3 pos, int satelliteID = 1) : base(screen)
|
public Satellite(IScreen screen, Vector3 pos, int satelliteID = 1) : base(screen)
|
||||||
{
|
{
|
||||||
Type = ObjectType.Satellite;
|
Type = ObjectType.Satellite;
|
||||||
SatelliteID = satelliteID;
|
SatelliteID = satelliteID;
|
||||||
Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/"+SatelliteID.ToString()+"/loop.wav");
|
Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/"+SatelliteID.ToString()+"/loop.wav");
|
||||||
Sound.Loop = true;
|
Sound.Loop = true;
|
||||||
|
Sound.Pitch = 0.9 + rnd.NextDouble()*0.5;
|
||||||
Position = pos;
|
Position = pos;
|
||||||
Dimensions = new Vector3(5, 5, 5);
|
Dimensions = new Vector3(5, 5, 5);
|
||||||
Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z);
|
Sound.Position = new System.Numerics.Vector3(pos.X, pos.Y, pos.Z);
|
||||||
Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
Sound.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
|
FlightPath = Matrix.CreateFromAxisAngle(Rotation.Right, (float)rnd.NextDouble()*0.1f);
|
||||||
|
Rotation = FlightPath;
|
||||||
Activate();
|
Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,12 +48,19 @@ namespace EvilSatellites.Objects
|
|||||||
|
|
||||||
override public void Update(GameTime gameTime)
|
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)
|
public override void OnCollision(IGameObject obj)
|
||||||
{
|
{
|
||||||
Health -= 10;
|
Health -= 10;
|
||||||
|
if (obj.Type == ObjectType.Player)
|
||||||
|
{
|
||||||
|
var player = (Player)obj;
|
||||||
|
player.TakeDamage(66);
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
if (Health <= 0)
|
if (Health <= 0)
|
||||||
{
|
{
|
||||||
Screen.Manager.Sound.PlayOneshot(@"sfx/satellite/"+SatelliteID.ToString()+"/explode.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z));
|
Screen.Manager.Sound.PlayOneshot(@"sfx/satellite/"+SatelliteID.ToString()+"/explode.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z));
|
||||||
|
|||||||
+14
-2
@@ -17,15 +17,22 @@ namespace EvilSatellites
|
|||||||
public IGameObject Target;
|
public IGameObject Target;
|
||||||
public IScreen Screen;
|
public IScreen Screen;
|
||||||
public ISoundEffect RadarNoise;
|
public ISoundEffect RadarNoise;
|
||||||
|
public ObjectType Filter;
|
||||||
public Radar(IGameObject owner, IScreen screen)
|
public Radar(IGameObject owner, IScreen screen)
|
||||||
{
|
{
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
Screen = screen;
|
Screen = screen;
|
||||||
RadarNoise = Screen.Manager.Sound.Load(@"sfx/ui/radar/pingEnemy.wav", false);
|
RadarNoise = Screen.Manager.Sound.Load(@"sfx/ui/radar/pingEnemy.wav", false);
|
||||||
RadarNoise.Loop = true;
|
RadarNoise.Loop = true;
|
||||||
|
Filter = ObjectType.Satellite;
|
||||||
Active = false;
|
Active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetObjectType(ObjectType type)
|
||||||
|
{
|
||||||
|
Filter = type;
|
||||||
|
}
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
RadarNoise.Reset();
|
RadarNoise.Reset();
|
||||||
@@ -43,9 +50,10 @@ namespace EvilSatellites
|
|||||||
{
|
{
|
||||||
if (objects.Count < 1) return;
|
if (objects.Count < 1) return;
|
||||||
float minDistance = 1000;
|
float minDistance = 1000;
|
||||||
|
Target = null;
|
||||||
foreach (var obj in objects)
|
foreach (var obj in objects)
|
||||||
{
|
{
|
||||||
if (obj.Type != ObjectType.Satellite) continue;
|
if (obj.Type != Filter) continue;
|
||||||
float distance = Vector3.Distance(obj.Position, Owner.Position);
|
float distance = Vector3.Distance(obj.Position, Owner.Position);
|
||||||
if (distance < minDistance)
|
if (distance < minDistance)
|
||||||
{
|
{
|
||||||
@@ -53,7 +61,11 @@ namespace EvilSatellites
|
|||||||
Target = obj;
|
Target = obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Target == null) return;
|
if (Target == null)
|
||||||
|
{
|
||||||
|
RadarNoise.Pitch = 0.1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
Vector3 radarTarget = (Target.Position - Owner.Position);
|
Vector3 radarTarget = (Target.Position - Owner.Position);
|
||||||
radarTarget.Normalize();
|
radarTarget.Normalize();
|
||||||
RadarNoise.Pitch = MathHelper.Clamp(0.1f / Vector3.Distance(Owner.Rotation.Forward, radarTarget) * 3f, 0, 1);
|
RadarNoise.Pitch = MathHelper.Clamp(0.1f / Vector3.Distance(Owner.Rotation.Forward, radarTarget) * 3f, 0, 1);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace EvilSatellites.Screens
|
|||||||
Player player = new Player(this);
|
Player player = new Player(this);
|
||||||
Objects.Add(player);
|
Objects.Add(player);
|
||||||
_player = player;
|
_player = player;
|
||||||
Satellite prop = new Satellite(this, new Vector3(15, 0, 15));
|
Satellite prop = new Satellite(this, new Vector3(5000, 5000, 5000));
|
||||||
Objects.Add(prop);
|
Objects.Add(prop);
|
||||||
ObjectRadar = new Radar(_player, this);
|
ObjectRadar = new Radar(_player, this);
|
||||||
return;
|
return;
|
||||||
@@ -63,7 +63,7 @@ namespace EvilSatellites.Screens
|
|||||||
objtree.Add(obj);
|
objtree.Add(obj);
|
||||||
if (obj.Type == ObjectType.Player)
|
if (obj.Type == ObjectType.Player)
|
||||||
{
|
{
|
||||||
Manager.Sound.ListenerPosition = new System.Numerics.Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z);
|
Manager.Sound.ListenerPosition = new System.Numerics.Vector3(obj.Position.X+obj.Dimensions.X/2, obj.Position.Y+obj.Dimensions.Y/2, obj.Position.Z+obj.Dimensions.Z/2);
|
||||||
Manager.Sound.ListenerOrientationForward = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Forward.X, obj.Rotation.Forward.Y, obj.Rotation.Forward.Z));
|
Manager.Sound.ListenerOrientationForward = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Forward.X, obj.Rotation.Forward.Y, obj.Rotation.Forward.Z));
|
||||||
Manager.Sound.ListenerOrientationUpwards = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Up.X, obj.Rotation.Up.Y, obj.Rotation.Up.Z));
|
Manager.Sound.ListenerOrientationUpwards = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Up.X, obj.Rotation.Up.Y, obj.Rotation.Up.Z));
|
||||||
Manager.Listener.Position = obj.Position;
|
Manager.Listener.Position = obj.Position;
|
||||||
@@ -130,6 +130,14 @@ namespace EvilSatellites.Screens
|
|||||||
{
|
{
|
||||||
_player.StopElevating();
|
_player.StopElevating();
|
||||||
}
|
}
|
||||||
|
if (Input.IsJustPressed(Keys.V))
|
||||||
|
{
|
||||||
|
_player.StartVacuuming(gameTime);
|
||||||
|
}
|
||||||
|
if (Input.IsJustReleased(Keys.V))
|
||||||
|
{
|
||||||
|
_player.StopVacuuming();
|
||||||
|
}
|
||||||
_player.Accelerate(move);
|
_player.Accelerate(move);
|
||||||
if (Input.IsJustPressed(Keys.Space))
|
if (Input.IsJustPressed(Keys.Space))
|
||||||
{
|
{
|
||||||
@@ -139,14 +147,6 @@ namespace EvilSatellites.Screens
|
|||||||
{
|
{
|
||||||
_player.CurrentWeapon.Stop();
|
_player.CurrentWeapon.Stop();
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.V))
|
|
||||||
{
|
|
||||||
Tolk.Speak(_player.Movement.Length().ToString(), true);
|
|
||||||
}
|
|
||||||
if (Input.IsJustPressed(Keys.C))
|
|
||||||
{
|
|
||||||
Tolk.Speak(_player.Position.ToString());
|
|
||||||
}
|
|
||||||
if (Input.IsJustPressed(Keys.R))
|
if (Input.IsJustPressed(Keys.R))
|
||||||
{
|
{
|
||||||
if (ObjectRadar.Active)
|
if (ObjectRadar.Active)
|
||||||
@@ -157,9 +157,17 @@ namespace EvilSatellites.Screens
|
|||||||
ObjectRadar.Start();
|
ObjectRadar.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.O))
|
if (Input.IsJustPressed(Keys.T))
|
||||||
{
|
{
|
||||||
Tolk.Speak(Objects.Count.ToString());
|
if (ObjectRadar.Filter == ObjectType.Satellite)
|
||||||
|
{
|
||||||
|
ObjectRadar.SetObjectType(ObjectType.Debris);
|
||||||
|
Tolk.Output("Debris");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ObjectRadar.SetObjectType(ObjectType.Satellite);
|
||||||
|
Tolk.Output("Satellites");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:81c7340107f82cee2d8f968a94f40be9c326b820d87c1216368979216bbc2ab6
|
||||||
|
size 269864
|
||||||
Reference in New Issue
Block a user