示例#1
0
 private void MakeShoot()
 {
     if (GameRandom.RandNumber(0, 64) == 0 && Ammo > 0)
     {
         Ammo--;
         var shell = new Shell(GUIForm, this);
         shell.Subscribe();
         InvokeShot(new ShellEventArgs(shell));
     }
 }
示例#2
0
 public override void SetNewStageParameters()
 {
     MoveToStartPosition();
     Direction = Direction.Down;
     Lives     = 0;
     Stars     = GameRandom.RandNumber(0, 3);
     Immortal  = false;
     Amphibian = false;
     Gun       = false;
     MoveTimer.Stop();
     RespawnTimer.Start();
 }
示例#3
0
 private void Rotate()
 {
     if (GameRandom.RandNumber(0, 1) == 0)
     {
         ChangeDirection();
     }
     else if (GameRandom.RandNumber(0, 1) == 0)
     {
         RotateClockwise();
     }
     else
     {
         RotateAnticlockwise();
     }
 }
示例#4
0
 private void CheckTileReach()
 {
     if (Rect.X % 64 == 0 && Rect.Y % 64 == 0 && GameRandom.RandNumber(0, 64) == 0)
     {
         ChangeDirection();
     }
     else if (Dx == 0 && Dy == 0 && GameRandom.RandNumber(0, 16) == 0)
     {
         if (Rect.X % 64 != 0 || Rect.Y % 64 != 0)
         {
             InvertDirection();
         }
         else
         {
             Rotate();
         }
     }
 }
示例#5
0
        protected override void MoveToStartPosition()
        {
            switch (GameRandom.RandNumber(1, 3))
            {
            case 1:
                Rect = new Rectangle(64, 64, 64, 64);
                break;

            case 2:
                Rect = new Rectangle(448, 64, 64, 64);
                break;

            case 3:
                Rect = new Rectangle(832, 64, 64, 64);
                break;

            default:
                break;
            }
        }
示例#6
0
 public void ChangeDirection()
 {
     Direction = (Direction)GameRandom.RandNumber(0, 3);
 }
示例#7
0
 private void MoveToNewPosition()
 {
     Rect = new Rectangle(64 + GameRandom.RandNumber(0, 24) * 32, 64 + GameRandom.RandNumber(0, 24) * 32, 64, 64);
 }
示例#8
0
 private void GenerateRandomBonus()
 {
     CurrentBonus = _bonuses[GameRandom.RandNumber(0, _bonuses.Count - 1)];
 }