Lots of stuff
This commit is contained in:
@@ -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