Lots of stuff

This commit is contained in:
2021-04-19 15:41:37 +02:00
parent 3d9ca3d590
commit 589124c5fc
10 changed files with 120 additions and 24 deletions
+38 -2
View File
@@ -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);
}
}
}