Bug fixes

This commit is contained in:
2021-04-24 23:31:43 +02:00
parent a7765e5355
commit 1265db9095
113 changed files with 346 additions and 120 deletions
+18 -12
View File
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SynthySound;
using Microsoft.Xna.Framework;
namespace EvilSatellites
{
@@ -12,10 +13,12 @@ namespace EvilSatellites
public Synthy Engine;
public Dictionary<string, AIVoiceClip> Clips;
public Random rnd = new Random();
public double LastSpeakTimer;
public AI(Synthy engine)
{
Engine = engine;
Clips = new Dictionary<string, AIVoiceClip>();
LastSpeakTimer = 10000;
SetupClips();
}
@@ -39,7 +42,7 @@ namespace EvilSatellites
{
Name = "DamageBullet",
NumFiles = 4,
Probability = new int[2] { 5, 10 }
Probability = new int[2] { 2, 4 }
});
Clips.Add("DamageDebris", new AIVoiceClip
@@ -49,18 +52,17 @@ namespace EvilSatellites
Probability = new int[2] { 2, 4 }
});
// TODO
Clips.Add("FarMiss", new AIVoiceClip
{
Name = "FarMiss",
NumFiles = 6,
Probability = new int[2] { 5, 50 }
Probability = new int[2] { 5, 30 }
});
Clips.Add("GameOver", new AIVoiceClip
{
Name = "GameOver",
NumFiles = 4,
NumFiles = 2,
Probability = new int[2] { 1, 1 }
});
@@ -78,15 +80,13 @@ namespace EvilSatellites
Probability = new int[2] { 1, 3 }
});
// TODO
Clips.Add("NearMiss", new AIVoiceClip
{
Name = "NearMiss",
NumFiles = 4,
Probability = new int[2] { 50, 100 }
Probability = new int[2] { 5, 30 }
});
// TODO
Clips.Add("Spinning", new AIVoiceClip
{
Name = "Spinning",
@@ -94,20 +94,18 @@ namespace EvilSatellites
Probability = new int[2] { 2, 4 }
});
// TODO
Clips.Add("Still", new AIVoiceClip
{
Name = "Still",
NumFiles = 5,
Probability = new int[2] { 2, 4 }
Probability = new int[2] { 1, 1 }
});
// TODO
Clips.Add("Void", new AIVoiceClip
{
Name = "Void",
NumFiles = 3,
Probability = new int[2] { 50, 200 }
Probability = new int[2] { 5, 100 }
});
Clips.Add("Wave", new AIVoiceClip
@@ -120,17 +118,25 @@ namespace EvilSatellites
public void Play(string name)
{
if (GameSettings.EnableAI == false) return;
if (LastSpeakTimer < 4000) return;
if (Clips.ContainsKey(name))
{
var clip = Clips[name];
var prob = rnd.Next(clip.Probability[1]);
if (prob == clip.Probability[0] || (clip.Probability[0] == 1 && clip.Probability[1] == 1))
{
var file = rnd.Next(clip.NumFiles - 1) + 1;
var file = rnd.Next(1, clip.NumFiles+1);
Engine.PlayOneshot(@"sfx/ai/" + name + file.ToString() + ".wav");
LastSpeakTimer = 0;
}
}
}
public void Update(GameTime time)
{
LastSpeakTimer += time.ElapsedGameTime.TotalMilliseconds;
}
}
public struct AIVoiceClip
{