Add basic radar and weapon

This commit is contained in:
2021-04-11 17:09:57 +02:00
parent 1c2fc7b86b
commit 2f7759d190
26 changed files with 465 additions and 45 deletions
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using EvilSatellites.Screens;
namespace EvilSatellites.Objects
{
+5
View File
@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using SynthySound;
using EvilSatellites.Screens;
using EvilSatellites.Weapons;
namespace EvilSatellites.Objects
{
@@ -13,6 +15,7 @@ namespace EvilSatellites.Objects
private Vector3 Deceleration = new Vector3(0.005f, 0.005f, 0.005f);
private ISoundEffect sfxEngine;
private ISoundEffect sfxWhine;
public IWeapon CurrentWeapon;
public Player(IScreen screen): base(screen)
{
Type = ObjectType.Player;
@@ -21,6 +24,7 @@ namespace EvilSatellites.Objects
Movement = new Vector3(0, 0, 0);
Rotation = Matrix.Identity;
Orientation = Rotation.Forward;
CurrentWeapon = new LaserMG(this, Screen);
Activate();
}
@@ -43,6 +47,7 @@ namespace EvilSatellites.Objects
}
override public void Update(GameTime gameTime)
{
CurrentWeapon.Update(gameTime);
Move(Movement);
sfxEngine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 4;
sfxWhine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 1;
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SynthySound;
using EvilSatellites.Screens;
using Microsoft.Xna.Framework;
namespace EvilSatellites.Objects
{
public class Satellite : AbstractGameObject
{
private ISoundEffect3D Sound;
public Satellite(IScreen screen, Vector3 pos) : base(screen)
{
Sound = Screen.Manager.Sound.Load3D(@"sfx/satellite/1/loop.wav");
Sound.Loop = true;
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);
Activate();
}
public override void Activate()
{
Sound.Play();
}
public override void Destroy()
{
Sound.Destroy();
}
override public void Update(GameTime gameTime)
{
Sound.Position = new System.Numerics.Vector3(Position.X, Position.Y, Position.Z);
}
public override void OnCollision(IGameObject obj)
{
Sound.Stop();
}
}
}
+1
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using SynthySound;
using EvilSatellites.Screens;
namespace EvilSatellites.Objects
{