예제 #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)];
 }