コード例 #1
0
ファイル: Zombie.cs プロジェクト: Grub0/HumansVsZombies
 /// <summary>
 /// Summons Lots of Zombies, Fast.
 /// </summary>
 /// <param name="z">Zombie in question</param>
 /// <param name="graphicsWidth">Graphics Width</param>
 /// <param name="graphicsHeight">Graphics Height</param>
 public void RecursiveSummoning(Zombie z, int graphicsWidth, int graphicsHeight)
 {
     if (this.CheckCollision(z) == true)
     {
         Random rand = new Random();
         this.XValue = rand.Next(rand.Next(100, graphicsWidth) - 100);
         this.YValue = rand.Next(rand.Next(100, graphicsHeight) - 100);
         RecursiveSummoning(z, graphicsWidth, graphicsHeight);
     }
 }
コード例 #2
0
ファイル: Zombie.cs プロジェクト: Grub0/HumansVsZombies
 /// <summary>
 /// What to do if they hit another zombie
 /// </summary>
 /// <param name="z">The zombie it collides with</param>
 public void HitOtherZomibe(Zombie z)
 {
     if (this.CheckCollision(z) == true)
     {
         this.XValue = previousZombiePosition.X;
         this.YValue = previousZombiePosition.Y;
         currentZombiePosition = previousZombiePosition;
     }
 }