Spawn more debris

This commit is contained in:
2021-04-21 18:39:33 +02:00
parent c3c42506fa
commit 619aa130d5
5 changed files with 21 additions and 6 deletions
Binary file not shown.
+1 -1
View File
@@ -56,7 +56,7 @@ namespace EvilSatellites.Objects
var player = (Player)obj; var player = (Player)obj;
if (player.Vacuuming) if (player.Vacuuming)
{ {
player.CurrentWeapon.Reload(rnd.Next(player.CurrentWeapon.MaxAmmo)); player.CurrentWeapon.Reload(rnd.Next(player.CurrentWeapon.MaxAmmo/4));
Destroy(); Destroy();
return; return;
} }
+4
View File
@@ -87,9 +87,13 @@ namespace EvilSatellites.Objects
} }
public void SpawnDebris() public void SpawnDebris()
{
var amount = rnd.Next(3) + 1;
for (var i = 0; i < amount; i++)
{ {
var screen = (GameScreen)Screen; var screen = (GameScreen)Screen;
screen.AddObject(new Debris(screen, Position)); screen.AddObject(new Debris(screen, Position));
} }
} }
}
} }
+2 -1
View File
@@ -22,6 +22,7 @@ namespace EvilSatellites
public Vector3 RadarPosition; public Vector3 RadarPosition;
public bool IsPlaying; public bool IsPlaying;
public Vector3 RadarTarget; public Vector3 RadarTarget;
public Matrix RadarOrientation;
public Radar(IGameObject owner, IScreen screen) public Radar(IGameObject owner, IScreen screen)
{ {
Owner = owner; Owner = owner;
@@ -113,7 +114,7 @@ namespace EvilSatellites
RadarTarget = radarTarget; RadarTarget = radarTarget;
RadarPosition = new Vector3(Owner.Position.X+Owner.Dimensions.X/2, Owner.Position.Y+Owner.Dimensions.Y/2, Owner.Position.Z+Owner.Dimensions.Z/2); RadarPosition = new Vector3(Owner.Position.X+Owner.Dimensions.X/2, Owner.Position.Y+Owner.Dimensions.Y/2, Owner.Position.Z+Owner.Dimensions.Z/2);
RadarDirection = new Vector3(radarTarget.X*0.5f, radarTarget.Y*0.5f, radarTarget.Z*0.5f); RadarDirection = new Vector3(radarTarget.X*0.5f, radarTarget.Y*0.5f, radarTarget.Z*0.5f);
RadarOrientation = Matrix.Invert(Matrix.CreateTranslation(Target.Position) * Matrix.CreateLookAt(Target.Position, Owner.Position, Owner.Rotation.Up));
RadarNoise.Reset(); RadarNoise.Reset();
// RadarNoise.Play(); // RadarNoise.Play();
IsPlaying = true; IsPlaying = true;
+12 -2
View File
@@ -183,7 +183,7 @@ namespace EvilSatellites.Screens
if (Input.IsJustPressed(Keys.H)) if (Input.IsJustPressed(Keys.H))
{ {
_player.PlayTap(); _player.PlayTap();
Tolk.Output(_player.Health.ToString() + " health", true); Tolk.Output(Math.Round(_player.Health).ToString() + " health", true);
} }
if (Input.IsJustPressed(Keys.X)) if (Input.IsJustPressed(Keys.X))
{ {
@@ -193,7 +193,17 @@ namespace EvilSatellites.Screens
if (Input.IsJustPressed(Keys.Y)) if (Input.IsJustPressed(Keys.Y))
{ {
_player.PlayTap(); _player.PlayTap();
if (ObjectRadar.Target != null) Tolk.Output(Vector3.Distance(_player.Position, ObjectRadar.Target.Position).ToString() + " units", true); if (ObjectRadar.Target != null)
{
Tolk.Output(Math.Round(Vector3.Distance(_player.Position, ObjectRadar.Target.Position)).ToString() + " units", true);
var radarYaw = (float)System.Math.Atan2(ObjectRadar.RadarOrientation.M13, ObjectRadar.RadarOrientation.M33);
var radarPitch = (float)System.Math.Asin(-ObjectRadar.RadarOrientation.M23);
var playerYaw = (float)System.Math.Atan2(_player.Rotation.M13, _player.Rotation.M33);
var playerPitch = (float)System.Math.Asin(-_player.Rotation.M23);
var totalYaw = MathHelper.ToDegrees(MathHelper.WrapAngle(radarYaw - playerYaw + MathHelper.Pi));
var totalPitch = MathHelper.ToDegrees(MathHelper.WrapAngle(radarPitch - playerPitch));
Tolk.Output(Math.Round(totalYaw).ToString() + " horizontal, " + Math.Round(totalPitch).ToString() + " vertical");
}
} }
if (Input.IsJustPressed(Keys.O)) if (Input.IsJustPressed(Keys.O))
{ {