trigger multiple spray packets even after the packet is done.

This commit is contained in:
2018-04-04 16:42:32 +03:00
parent 501c08c181
commit 421a6b1a59
4 changed files with 30 additions and 0 deletions

View File

@ -60,6 +60,7 @@ namespace EduNetworkBuilder
public bool PuzzleIsSolved = true; //only set to false if we load a puzzle
public List<HelpTopics> SuggestedReadings = new List<HelpTopics>();
private DateTime NetworkStartTime = DateTime.Now;
private DateTime NextSprayTime = DateTime.Now;
private bool AlreadyChosenTimeout = false;
private int DefaultTimeout = 10;
private int NumberOfSecondsForTimeout = 10;
@ -1603,6 +1604,20 @@ namespace EduNetworkBuilder
{
if (Animations[i].AnimationDone) Animations.RemoveAt(i);
}
if(DateTime.Now > NextSprayTime)
{
Random myRnd = NB.GetRandom();
int ms = (myRnd.Next(10) + 2) * 250;
NextSprayTime = DateTime.Now.AddMilliseconds(ms);
foreach(NetworkComponent NC in NetComponents)
{
if(NC is NetworkDevice)
{
NetworkDevice ND = (NetworkDevice)NC;
ND.BadPacketIfIShould();
}
}
}
}
//if (myPackets.Count > 50)
//Console.WriteLine("Packets: " + myPackets.Count.ToString());