Пример #1
0
        public void initializeGame()
        {
            //This is where we populate the array planeLabels
            Label[] mplaneLabels = { planeLabel1, planeLabel2, planeLabel3 };
            planeLabels = mplaneLabels;
            //This is where we populate the array of FuelTanks
            ProgressBar[] mfuelTankArray = {fuelTank1, fuelTank2, fuelTank3};
            fuelTankArray = mfuelTankArray;
            //We fill the hangar with the initial amount of planes.  This is the total number of planes in the game
            //derp
            hangar = fillHangar(totalPlanesInAir + 1, difficulty);

            //Now we fill airspace, it is the array of airplanes currently in the air
            airspace = new airplane[totalPlanesInAir];
            for (int i = 0; i < totalPlanesInAir; i++)
            {
                airspace[i] = null;
            }
            fillAirspace();

            runway1 = new Runway(Canvas.GetLeft(runwayRect1), Canvas.GetTop(runwayRect1), runwayRect1.Width, runwayRect1.Height, 1, doNotEnter1);
            runway2 = new Runway(Canvas.GetLeft(runwayRect2), Canvas.GetTop(runwayRect2), runwayRect2.Width, runwayRect2.Height, 2, doNotEnter2);
            runway3 = new Runway(Canvas.GetLeft(runwayRect3), Canvas.GetTop(runwayRect3), runwayRect3.Width, runwayRect3.Height, 3, doNotEnter3);
        }
Пример #2
0
 public void Land(Runway landRunway)
 {
     landRunway.occupied = true;
     landRunway.updateTimer(airspace[airspaceIndex].timer);
     landRunway.redSign.Visibility = Visibility.Visible;
     highlightPlaneTag(false);
     score += (int)airspace[airspaceIndex].fuel.Value;
     scoreNum.Content = score;
     planeLabels[airspaceIndex].Content = "";
     airspace[airspaceIndex] = null;
     airspaceIndex = -1;
     capturedPlaneNumber.Content = "";
     checkForGameOver();
 }
Пример #3
0
 public void checkForLanding(Runway mrunway)
 {
     double landerx = Canvas.GetLeft(rightLander) + (rightLander.Width/2);
     double landery = Canvas.GetTop(rightLander) + (rightLander.Height/2);
     if (!mrunway.occupied && airspaceIndex != -1)
     {
         if (landerx > mrunway.x
             && landerx < (mrunway.x + mrunway.width)
             && landery > mrunway.y
             && landery < (mrunway.y + mrunway.height))
         {
             Land(mrunway);
             //rightLander.Fill = Brushes.AntiqueWhite;
             fillAirspace();
         }
     }
 }