static void Main(string[] args) { Console.WriteLine("Airplanes controller: \n"); Console.Beep(); var ABC123 = new PeoplePlane("ABC123", 50, 0, false, 350); var DDD888 = new PeoplePlane("DDD888", 35, 0, false, 450); var SSS777 = new PeoplePlane("SSS777", 70, 0, false, 250); //Operations on ABC123: Console.WriteLine($"Operations on {ABC123.PlaneId}: \n"); Console.Beep(3000, 300); ABC123.LoadPassengers(43); ABC123.TakeOff(); ABC123.Land(); ABC123.UnloadPassengers(43); //Operations on DDD888 Console.WriteLine($"Operations on {DDD888.PlaneId}: \n"); DDD888.LoadPassengers(23); DDD888.TakeOff(); DDD888.Land(); DDD888.UnloadPassengers(23); //Creating airport with airplanes var eindhovenAirport = new Airport("Eindhoven", ABC123, DDD888, SSS777); //Operations on the airport: eindhovenAirport.ListAirplanes(); eindhovenAirport.RequestPlaneDetails(); eindhovenAirport.LoadPassengersInto(ABC123, 55); //Instantiating cargo planes var FF2134 = new CargoPlane("FF2134", false, 0); var PLA166 = new CargoPlane("PLA166", false, 0); //Adding the two cargo planes to the airport Eindhoven: eindhovenAirport.AddCargoPlane(FF2134); eindhovenAirport.AddCargoPlane(PLA166); //Operations on the cargo planes eindhovenAirport.LoadCargoInto(FF2134, 17); //Calling the overriden ToString method Console.WriteLine(FF2134); Console.WriteLine(PLA166); Console.WriteLine(ABC123); Console.WriteLine(DDD888); Console.WriteLine(SSS777); Console.Beep(); //The spaceship var SPACE123 = new SpacePlane("SPACE123", false); SPACE123.LoadMissles(); SPACE123.StartStarterMotor(); }
static void Main(string[] args) { /*create an airport which has 3 people plane, * 2 cargo plane and 1 space plane*/ var airport1 = new Airport("Eindhoven"); //list all the airplanes of the airport airport1.ShowAirplanes(); //request airplanes and take some actions with them try { PeoplePlane airplane1 = (PeoplePlane)airport1.RequestPlane("ABC124"); airplane1.Load(133); airplane1.TakeOff(); airplane1.Load(5); airplane1.Land(); airplane1.Unload(); airport1.ShowAvailableAirplanes(); } catch (NullReferenceException ex) { Console.WriteLine(ex); } try { CargoPlane airplane2 = (CargoPlane)airport1.RequestPlane("FF2134"); airplane2.Load(25); airplane2.TakeOff(); airplane2.Unload(); airplane2.Land(); airplane2.Unload(); } catch (NullReferenceException ex) { Console.WriteLine(ex); } try { SpacePlane spaceAirplane = (SpacePlane)airport1.RequestPlane("SPC777"); spaceAirplane.StartMotor(); spaceAirplane.TakeOff(); spaceAirplane.TakeOverMissile(5); } catch (NullReferenceException ex) { Console.WriteLine(ex); } }
public void GetInPlane(SpacePlane spacePlane) { GameClient.I?.SendOwnershipRequest(spacePlane.NetObjGene.NetObj.Id); _rigidbody.isKinematic = true; transform.position = spacePlane.transform.position; _disableInput = true; _inPlane = true; MyPlane = spacePlane; foreach (var Collider in Colliders) { Collider.gameObject.SetActive(false); } spacePlane.NetObjGene.IsLocalPlayer = true; spacePlane.DisableInput = false; spacePlane.GetComponent <Rigidbody>().isKinematic = false; Camera.GetComponent <CameraVerticalLook>().enabled = false; }
void OnHitSpacePlane(SpacePlane spacePlane) { spacePlane.OnPointedAt(); HighlightedSpacePlane = spacePlane; //MyLogger.LogInfo("Hit spaceplane!"); }
private void generateEnemiesFuelOrCrystal(int[][] lvl, int current, float posx, float posy, float diffx) { //1.85f longest item size int propability = 3; //propability of generate item float x, y; int r, c; int diff1, diff2, diff; float x1, x2; x = 3; y = posy; if (!(random.Next(1, propability + 1) == propability)) { if (lvl[current][1] == 0) { if (current < lvl.Length - 1) { diff1 = lvl[current + 1][0] - lvl[current][0]; } else { diff1 = 0; } diff2 = lvl[current - 1][0] - lvl[current][0]; diff = Math.Max(diff1, diff2); if (diff > 1) { x1 = posx - diffx * ((scale / 2) - lvl[current][0]) + (1.85f * diff); x2 = posx + diffx * ((scale / 2) - lvl[current][0]) - (1.85f * diff); } else { x1 = posx - diffx * ((scale / 2) - lvl[current][0]) + (1.85f / 2); x2 = posx + diffx * ((scale / 2) - lvl[current][0]) - (1.85f / 2); } x = (float)random.NextDouble() * (x2 - x1) + x1; } else { if (current < lvl.Length - 1) { diff1 = lvl[current + 1][1] - lvl[current][1]; } else { diff1 = 0 - lvl[current][1]; } diff2 = lvl[current - 1][1] - lvl[current][1]; diff = Math.Max(diff1, diff2); if (diff >= 1) { if (diff > 3) { if (random.Next(0, 2) == 0) { x = posx - diffx * ((scale / 2) - lvl[current][0]) + 1.85f; } else { x = posx + diffx * ((scale / 2) - lvl[current][0]) - 1.85f; } } else { if (random.Next(0, 2) == 0) { x = posx - ((diffx * lvl[current][1]) / 2.0f) - (diff * 2 * (1.85f / 3)); } else { x = posx + ((diffx * lvl[current][1]) / 2.0f) + (diff * 2 * (1.85f / 3)); } } } else { if (random.Next(0, 2) == 0) { x = posx - ((diffx * lvl[current][1]) / 2.0f) - (1.85f / 2); } else { x = posx + ((diffx * lvl[current][1]) / 2.0f) + (1.85f / 2); } } } //chose what type of item should be spawned r = random.Next(0, 115); c = propabilityArray[r]; //statement for preventing generating tanks in tight corridors if (lvl[current][1] >= 9 && c == 0) { do { r = random.Next(0, 115); c = propabilityArray[r]; } while (c == 0); } switch (c) { case (0): { Tank tank = new Tank(90 + (MainScript.Player.Level * 10), x, y, -100); break; } case (1): { RedEnemy redEnemy = new RedEnemy(90 + (MainScript.Player.Level * 10), x, y, 175); break; } case (2): { int rSide = random.Next(-1, 2); if (rSide == 0) { rSide = -1; } SpacePlane spacePlane = new SpacePlane(90 + (MainScript.Player.Level * 10), 13.5f * rSide, y, 500 * rSide * -1); break; } case (3): { FuelTank fueltank = new FuelTank(x, y); break; } case (4): { Crystal crystal = new Crystal(x, y); break; } } } }
private void Form1_Load(object sender, EventArgs e) { // initialize the polygons polygons = new GMapOverlay("polygons"); // initialize voice recognition objects clist = new Choices(); // initialization for radar map bitmap_radar = new Bitmap(WIDTH + 1, HEIGHT + 1); radar_box.BackColor = System.Drawing.Color.Black; cx = WIDTH / 2; cy = HEIGHT / 2; u = 0; t.Elapsed += OnTimedEvent; t.AutoReset = true; t.Enabled = true; LATITUDE = 47.2427655; LONGITUDE = -122.455138; // variables for keeping track of target and base positions pointBase = new PointLatLng(LATITUDE, LONGITUDE); pointTarget = new PointLatLng(33.0166666, -116.6833306); KeyPreview = true; Focus(); #region map_setup mapProviders = new GMapProvider[4]; mapProviders[2] = GMapProviders.BingHybridMap; mapProviders[1] = GMapProviders.GoogleHybridMap; mapProviders[0] = GMapProviders.GoogleMap; mapProviders[3] = GMapProviders.GoogleSatelliteMap; GMapProviders.GoogleMap.ApiKey = "your GMAP API"; for (int i = 0; i < 4; i++) { cbMapProviders.Items.Add(mapProviders[i]); } MainMap.DragButton = MouseButtons.Right; MainMap.MinZoom = 1; MainMap.MaxZoom = 20; MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/mapcache/"; MainMap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; MainMap.DragButton = MouseButtons.Left; GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache; MainMap.Position = new PointLatLng(LATITUDE, LONGITUDE); MainMap.MarkersEnabled = true; MainMap.ShowCenter = false; overlayPlane = new GMapOverlay("plane"); MainMap.Overlays.Add(overlayPlane); // add plane marker to the overlay on map markers = new GMapOverlay("markers"); Bitmap stationLabel = Blimp_GCS.Properties.Resources.AirTower; Bitmap baseLabel = new Bitmap(stationLabel, new Size(90, 90)); marker_base = new GMarkerGoogle( pointBase, baseLabel); using (var fire_img = Blimp_GCS.Properties.Resources.SOS) { marker_fire = new Bitmap(fire_img, new Size(50, 40)); } routes = new GMapOverlay("routes"); MainMap.Overlays.Add(routes); marker_target = new GMarkerGoogle( pointTarget, GMarkerGoogleType.red_pushpin); var route = GoogleMapProvider.Instance.GetRoute(pointBase, pointTarget, false, false, 7); trajectory = new GMapRoute(route.Points, "trajectory") { Stroke = new Pen(System.Drawing.Color.Transparent, 2) }; routes.Routes.Add(trajectory); //markers.Markers.Add(marker_target); markers.Markers.Add(marker_base); MainMap.Overlays.Add(markers); MainMap.Zoom = 4; // plane will take off from base sp = new SpacePlane(pointBase.Lat, pointBase.Lng, 20, 0); sp2 = new SpacePlane(pointBase.Lat + 5, pointBase.Lng + 5, 20, 0); sp.unlockTarget(); sp2.unlockTarget(); plane_marker = sp.getMarker(); overlayPlane.Markers.Add(plane_marker); Timer t_plane = new Timer(); t_plane.Interval = 200; // update the plane position every 200 ms t_plane.Elapsed += (sender_plane, e_plane) => plane_update(sender_plane, e_plane); t_plane.AutoReset = true; t_plane.Enabled = true; #endregion }