Add basic radar and weapon
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using XVector3 = Microsoft.Xna.Framework.Vector3;
|
||||
using System.Numerics;
|
||||
using SynthySound;
|
||||
|
||||
namespace EvilSatellites
|
||||
{
|
||||
public class AudioAsset3D
|
||||
{
|
||||
private List<ISoundEffect3D> _SoundList { get; set; }
|
||||
private string _Path;
|
||||
private Synthy _Engine;
|
||||
private Vector3 _Position;
|
||||
public Vector3 Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Position = value;
|
||||
foreach (var sound in _SoundList)
|
||||
{
|
||||
sound.Position = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private Random rnd;
|
||||
private int _Min;
|
||||
private int _Max;
|
||||
public AudioAsset3D(Synthy engine, string path, int min, int max)
|
||||
{
|
||||
_SoundList = new List<ISoundEffect3D>();
|
||||
_Engine = engine;
|
||||
_Path = path;
|
||||
_Max = max;
|
||||
_Min = min;
|
||||
rnd = new Random();
|
||||
LoadAssets();
|
||||
}
|
||||
|
||||
private void LoadAssets()
|
||||
{
|
||||
for (var i = _Min; i <= _Max; i++)
|
||||
{
|
||||
Console.WriteLine(_Path + "/" + i.ToString() + ".wav");
|
||||
_SoundList.Add(_Engine.Load3D(_Path + "/" + i.ToString() + ".wav"));
|
||||
}
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
var index = rnd.Next(_SoundList.Count);
|
||||
_SoundList[index].Reset();
|
||||
_SoundList[index].Play();
|
||||
}
|
||||
|
||||
public void AddEffect(IEffect effect)
|
||||
{
|
||||
foreach (var sound in _SoundList)
|
||||
{
|
||||
sound.ConnectToEffect(effect);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveEffect(IEffect effect)
|
||||
{
|
||||
foreach (var sound in _SoundList)
|
||||
{
|
||||
sound.DisconnectFromEffect(effect);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var sound in _SoundList)
|
||||
{
|
||||
sound.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user