diff --git a/EduNetworkBuilder/AnimationClass.cs b/EduNetworkBuilder/AnimationClass.cs index 1bb1fa2..d3a5332 100644 --- a/EduNetworkBuilder/AnimationClass.cs +++ b/EduNetworkBuilder/AnimationClass.cs @@ -17,7 +17,7 @@ namespace EduNetworkBuilder public DateTime NextAnimation; int AnimationCount = 0; int AnimationSpeed = 150; //ms between animations - int maxAnim = 6; + int maxAnim = 12; bool erased = true; public bool AnimationDone { get { if (AnimationCount > 0) return false; return true; } } @@ -31,17 +31,28 @@ namespace EduNetworkBuilder case AnimationName.Fire1: ImageStartPoint = new Point(0,0); HowBig = new Size(100, 100); - AnimationCount = 6; + AnimationCount = 12; + maxAnim = 12; + AnimationSpeed = 100; + break; + case AnimationName.Explo1: + ImageStartPoint = new Point(0, 400); + HowBig = new Size(100, 100); + AnimationCount = 12; + maxAnim = 12; + AnimationSpeed = 100; break; case AnimationName.Smoke1: - ImageStartPoint = new Point(0, 100); - HowBig = new Size(100, 100); - AnimationCount = 6; - break; - case AnimationName.Spark1: ImageStartPoint = new Point(0, 200); HowBig = new Size(100, 100); AnimationCount = 6; + maxAnim = 6; + break; + case AnimationName.Spark1: + ImageStartPoint = new Point(0, 300); + HowBig = new Size(100, 100); + AnimationCount = 6; + maxAnim = 6; break; } NextAnimation = DateTime.UtcNow.AddMilliseconds(AnimationSpeed); @@ -51,7 +62,15 @@ namespace EduNetworkBuilder { if (AnimationCount < 0) return; if (!erased) return; - Rectangle AniminSnip = new Rectangle((maxAnim - AnimationCount) * HowBig.Width, ImageStartPoint.Y, HowBig.Width, HowBig.Height); + int sx = (maxAnim - AnimationCount) * HowBig.Width; + int sy = ImageStartPoint.Y; + if(sx >= Properties.Resources.Animations.Width) + { + sy = sy + HowBig.Height; + sx = sx - Properties.Resources.Animations.Width; + } + //Console.WriteLine("Anim: x:" + sx + " y:" + sy); + Rectangle AniminSnip = new Rectangle(sx, sy, HowBig.Width, HowBig.Height); Graphics.FromImage(TheNetworkImage).DrawImage(Properties.Resources.Animations, Where, AniminSnip, GraphicsUnit.Pixel); myPB.Invalidate(Where); } diff --git a/EduNetworkBuilder/EduNetworkBuilder.csproj b/EduNetworkBuilder/EduNetworkBuilder.csproj index 6bbf555..38ed65a 100644 --- a/EduNetworkBuilder/EduNetworkBuilder.csproj +++ b/EduNetworkBuilder/EduNetworkBuilder.csproj @@ -428,7 +428,6 @@ - @@ -436,6 +435,7 @@ + diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index 05dc50d..ea22880 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -50,7 +50,7 @@ namespace EduNetworkBuilder LockVLANsOnHost, LockNicVLAN, LockInterfaceVLAN, LockVLANNames, DeviceIsFrozen, DeviceBlowsUpWithPower, DeviceNeedsUPS, } - public enum AnimationName { Spark1, Fire1, Smoke1 } + public enum AnimationName { Spark1, Fire1, Smoke1, Explo1 } public enum ContextTest { ping, arp, traceroute } public enum NetTestVerbosity { none, basic, hints, full } public enum LBContents { routes, messages, dhcp, puzzles } diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index aea3bd1..615a9c1 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -987,16 +987,22 @@ namespace EduNetworkBuilder { Rectangle Where = new Rectangle(ItemClickedOn.myLocation().X, ItemClickedOn.myLocation().Y - ((ItemClickedOn.Size * 2) / 3), ItemClickedOn.Size, ItemClickedOn.Size); - if(ItemClickedOn.IsBurned) + if (ItemClickedOn.IsBurned) { int which = GameRandomGen.Next(3); - if(which ==0) + if (which == 0) myNetwork.AddAnimation(AnimationName.Spark1, Where); else myNetwork.AddAnimation(AnimationName.Smoke1, Where); } else - myNetwork.AddAnimation(AnimationName.Fire1, Where); + { + int which = GameRandomGen.Next(3); + if (which == 0) + myNetwork.AddAnimation(AnimationName.Explo1, Where); + else + myNetwork.AddAnimation(AnimationName.Fire1, Where); + } ItemClickedOn.IsBurned = true; ItemClickedOn.PowerOff = true; //It remains off. } diff --git a/EduNetworkBuilder/Resources/Animations.png b/EduNetworkBuilder/Resources/Animations.png index f6e2d26..4444ae8 100644 Binary files a/EduNetworkBuilder/Resources/Animations.png and b/EduNetworkBuilder/Resources/Animations.png differ