public void HelicopterTakeOff() { Helicopter heli = airplane; bool engineStarted; bool engineEnd; bool isFlyingBeginning; bool isFlyingEnd; engineStarted = heli.Engine.IsStarted; engineEnd = true; isFlyingBeginning = heli.IsFlying; isFlyingEnd = true; Assert.AreEqual(false, engineStarted);// test engine class heli.Engine.Start(); Assert.AreEqual(true, heli.Engine.IsStarted); heli.Engine.Stop(); Assert.AreEqual(false, heli.Engine.IsStarted);//reset heli.TakeOff(); Assert.IsFalse(heli.IsFlying); heli.StartEngine(); Assert.AreEqual(engineEnd, heli.Engine.IsStarted); heli.TakeOff(); Assert.AreEqual(isFlyingEnd, heli.IsFlying); }
public override void OnInspectorGUI() { DrawDefaultInspector(); Helicopter heli = (Helicopter)target; if (GUILayout.Button("Load Default")) { heli.model.LoadDefault(); heli.FindComponents(); heli.ParametrizeUnityFromModel(); } /* * if (GUILayout.Button("Open Model")) { * var path = EditorUtility.OpenFilePanel("Open helicopter model", "", "helisharp"); * heli.model = JsonConvert.DeserializeObject<HeliSharp.SingleMainRotorHelicopter>(File.ReadAllText(path)); * heli.FindComponents(); * heli.ParametrizeUnityFromModel(); * } */ if (GUILayout.Button("Save Model")) { heli.ParametrizeModelsFromUnity(); var json = JsonConvert.SerializeObject(heli.model, Newtonsoft.Json.Formatting.Indented); var path = EditorUtility.SaveFilePanel("Save helicopter model", "", heli.name, "helisharp"); File.WriteAllText(path, json); } }
} //works out if an object is out of health private int DistanceTo(Unit u) { if (u.GetType() == typeof(Melee_Unit)) { Melee_Unit m = (Melee_Unit)u; int d = Math.Abs(XPos - m.XPos) + Math.Abs(YPos - m.YPos); return(d); } //end if else if (u.GetType() == typeof(Ranged_Unit)) { Ranged_Unit m = (Ranged_Unit)u; int d = Math.Abs(XPos - m.XPos) + Math.Abs(YPos - m.YPos); return(d); } //end else if else if (u.GetType() == typeof(Tank)) { Tank m = (Tank)u; int d = Math.Abs(XPos - m.XPos) + Math.Abs(YPos - m.YPos); return(d); } //end else else if (u.GetType() == typeof(Helicopter)) { Helicopter m = (Helicopter)u; int d = Math.Abs(XPos - m.XPos) + Math.Abs(YPos - m.YPos); return(d); } //end else else { Fighter_Jets m = (Fighter_Jets)u; int d = Math.Abs(XPos - m.XPos) + Math.Abs(YPos - m.YPos); return(d); } //end else } //works out distance from one unit to another
private void button1_Click(object sender, EventArgs e) { Helicopter h = new Helicopter(textBox2.Text); h.FlyHeight = Convert.ToInt32(textBox4.Text); h.show(); }
private void SaveCitizenAct() { Helicopter helicopter = mCharacter as Helicopter; Vector3 targetPos = helicopter.citiizenPos + (mCharacter.position.y - helicopter.citiizenPos.y) * Vector3.up; mReached = mCharacter.MoveTo(targetPos); }
static void Main(string[] args) { var helicopter = new Helicopter(150); userCode(helicopter); //demo(helicopter); }
IEnumerator SpawnHelicopters() { float elapsedTime = 0.0f; float timeToSpawn = 0.0f; while (true) { if (!running) { break; } if (elapsedTime >= timeToSpawn) { float spawnAngle = Random.Range(0.0f, Mathf.PI * 2.0f); Vector3 spawnOffset = new Vector3( Mathf.Cos(spawnAngle) * SPAWN_BUFFER_DISTANCE, HELICOPTER_HEIGHT, Mathf.Sin(spawnAngle) * SPAWN_BUFFER_DISTANCE ); GameObject go = CreatePrefab("Helicopter"); Vector3 cameraPosition = cameraHandle.position; cameraPosition.y = 0.0f; go.transform.position = cameraPosition + spawnOffset; Helicopter helicopter = go.GetComponent <Helicopter>(); helicopter.Initialize(); helicopters.Add(helicopter); elapsedTime = 0.0f; timeToSpawn = Random.Range(MIN_SPAWN_INTERVAL, MAX_SPAWN_INTERVAL); } elapsedTime += Time.deltaTime; yield return(new WaitForEndOfFrame()); } }
public void TestHeli() { apache = new Helicopter(); int testHeight = 87; TestAerial(apache, testHeight); }
static void Main() { var toyota = new Car("toyota", 0.15, 12, 95, "бензин", 64); var mercedes = new Car("mercedes", 0.22, 13, 100, "дизель", 58); var subaru = new Car("subaru", 0.05, 9, 120, "бензин", 60); var transports = new List <ITransportProperty> { toyota, subaru, mercedes }; var robinson = new Helicopter("robinson", 0.2, 25, 273, 900, 100); transports.Add(robinson); Serialization.Serialize(transports); var testList = new List <ITransportProperty>(); Serialization.Deserialize(ref testList); foreach (ITransportProperty element in testList) { Console.WriteLine(element.TransportName + "\n"); } }
public async Task <ActionResult> DeleteHeli([FromBody] UserDTO dto) { var cookie = Request.Cookies["SID"]; var isValid = _userService.RefreshSession(dto.UserName, cookie, dto.token, out User user); if (!isValid) { return(StatusCode(StatusCodes.Status401Unauthorized)); } HttpClient client = new HttpClient(); HttpRequestMessage heli = new HttpRequestMessage(); Helicopter h = new Helicopter(); h.heliId = dto.heliId; var json = JsonConvert.SerializeObject(h); var content = new StringContent(json, Encoding.UTF8, "application/json"); var request = new HttpRequestMessage { RequestUri = new Uri("http://localhost:8080/api/helicopter/" + h.heliId), Content = content, Method = HttpMethod.Delete }; HttpResponseMessage result = await client.SendAsync(request); return(Ok(result)); }
public void HelicopterFlyUp() { //Arrange Helicopter hc = this.Helicopter; //act hc.StartEngine(); string firstTakeoff = hc.TakeOff(); int defaultHeight = hc.CurrentAltitude; hc.FlyUp(); int firstAlt = hc.CurrentAltitude; hc.FlyUp(7000); int secondAlt = hc.CurrentAltitude; hc.FlyUp(1); // This should fail and return the same value as the previous. int thirdAlt = hc.CurrentAltitude; //Assert Assert.AreEqual(defaultHeight, 0); Assert.AreEqual(firstAlt, 1000); Assert.AreEqual(secondAlt, 8000); Assert.AreEqual(thirdAlt, secondAlt); }
void Start() { spawnPointsList = spawnPoints.GetComponentsInChildren <Transform>(); helicopter = FindObjectOfType <Helicopter>(); clearArea = GetComponentInChildren <ClearArea>(); ReSpawn(); }
public static void PrintHelicopter(Helicopter helicopter) { Console.SetCursorPosition(0, StartScreen.consoleWindowHeight - 1); Console.MoveBufferArea(helicopter.PreviousStartX, helicopter.PreviousStartY, helicopter.Width, helicopter.Height, helicopter.StartX, helicopter.StartY); }
public void CleanUp() { if (Pilot.Exists()) { Pilot.Dismiss(); } if (Paramedic1.Exists()) { Paramedic1.Delete(); } if (Paramedic2.Exists()) { Paramedic2.Delete(); } if (Helicopter.Exists()) { Helicopter.Dismiss(); } if (_heliBlip.Exists()) { _heliBlip.Delete(); } if (_notepad.Exists()) { _notepad.Delete(); } }
public void HelicopterAboutTest() { // Helicopter Instance to be Tested Helicopter h = new Helicopter(); Assert.AreEqual(h.About(), $"This {h.ToString()} has a max altitude of 41000 ft. \nIt's current altitude is 0 ft. \nThis{h.Engine.ToString()}'s engine is not started."); }
public void HelicopterFlyUpTest() { // Helicopter Instance to be Tested Helicopter h = new Helicopter(); // Setup h.StartEngine(); h.TakeOff(); // Have to not use custom fly up as the drone's max altitude is only 500 h.FlyUp(); int defaultFlyUp = h.CurrentAltitude; h.FlyUp(2000); int customFlyUp = h.CurrentAltitude; // This should not go up at all since it's too high so it shouldn't change the altitute h.FlyUp(100000); int limitFlyUp = h.CurrentAltitude; // Assess Assert.AreEqual(defaultFlyUp, 1000); Assert.AreEqual(customFlyUp, 3000); Assert.AreEqual(limitFlyUp, 3000); }
public bool IsCanPassDistanceTest(int distance, string name, double wearRate, double fuelWaste, double speed, double mass, double tankVolume) { Helicopter transport = new Helicopter(name, wearRate, fuelWaste, speed, mass, tankVolume); return(transport.IsCanPassDistance(distance)); }
private void AddHelicopter() { // TESTING Console.WriteLine("Entered Add Heli..."); Position start = new Position(-37.9061137, 176.2050742); Position end = new Position(-36.8613687, 174.7676895); Console.WriteLine("Set postitions..."); Helicopter heli = new Helicopter() { startPosition = start, destinationPosition = end }; Console.WriteLine("Created Heli..."); CustomPin heliPin = new CustomPin { CustomType = ODMSPinType.HELICOPTER, Label = "Heli", HelicopterDetails = heli, Position = heli.startPosition, Address = "1" }; Console.WriteLine("Created Helipin..."); customMap.HelicopterPins.Add(heliPin.Address, heliPin); customMap.Pins.Add(heliPin); }
void PlaceHelipad(Helicopter helicopter, int quad) { int placeQuad = (quad % 4) + 1; List <Block> b; if (placeQuad == 1) { b = firstQuad; } else if (placeQuad == 2) { b = secQuad; } else if (placeQuad == 3) { b = thirdQuad; } else { b = fourthQuad; } foreach (Block q in b) { if (q.ObjectPlaced == null && q.obj != null) { q.ObjectPlaced = Instantiate(helipad, this.transform); q.ObjectPlaced.GetComponent <RectTransform>().transform.position = q.obj.GetComponent <RectTransform>().transform.position; helicopter.helipad = q.ObjectPlaced; helicopter.block = q; break; } } }
public HeliAttack(Actor self, Target target) { this.target = target; helicopter = self.Trait <Helicopter>(); attackHeli = self.Trait <AttackHeli>(); ammoPools = self.TraitsImplementing <AmmoPool>(); }
public HeliAttack(Actor self, Target target) { this.target = target; helicopter = self.Trait<Helicopter>(); attackHeli = self.Trait<AttackHeli>(); ammoPools = self.TraitsImplementing<AmmoPool>().ToArray(); }
public static void MoveDown(Helicopter helicopter) { if (helicopter.StartY + helicopter.Height - 1 < Console.WindowHeight - 1) { helicopter.StartY++; } }
public static void MoveUp(Helicopter helicopter) { if (helicopter.StartY > 0) { helicopter.StartY--; } }
public void HelicopterFlyDown() { //Arrange Helicopter hc = this.Helicopter; //act hc.StartEngine(); string firstTakeoff = hc.TakeOff(); int defaultHeight = hc.CurrentAltitude; hc.FlyDown(); //test is flying again int FlyDown = hc.CurrentAltitude; hc.TakeOff(); hc.FlyDown(1); //test is flying again hc.TakeOff(); int FlyDownOneAlreadyZero = hc.CurrentAltitude; hc.FlyUp(2); hc.FlyDown(1); int FlyDownOneAtTwo = hc.CurrentAltitude; //Assert Assert.AreEqual(defaultHeight, 0); Assert.AreEqual(FlyDown, 0); Assert.AreEqual(FlyDownOneAlreadyZero, 0); Assert.AreEqual(FlyDownOneAtTwo, 1); }
static void Main(string[] args) { Plane pl = new Plane(5000, 4); pl.WriteAllProperties(); pl.TakeUpper(2000); pl.WriteAllProperties(); pl.TakeLower(1000); pl.WriteAllProperties(); Console.WriteLine(); Helicopter hc = new Helicopter(5000, 4); hc.WriteAllProperties(); hc.TakeUpper(2000); hc.WriteAllProperties(); hc.TakeLower(1000); hc.TakeUpper(10000); hc.WriteAllProperties(); Flyers fl = new Flyers(); Console.ReadKey(); }
void DropFlare() { Instantiate(landingAreaPrefab, this.transform.position, transform.rotation); Helicopter heli = FindObjectOfType <Helicopter> (); heli.SetPlayerPosition(this.transform.position); }
public void HelicopterFlyDownTest() { // Helicopter Instance to be Tested Helicopter h = new Helicopter(); // Setup h.StartEngine(); h.TakeOff(); h.FlyUp(); int defaultFlyUp = h.CurrentAltitude; h.FlyDown(200); int flyDown = h.CurrentAltitude; // The value should not change as you are flying down more feet than you are up in the air h.FlyDown(100000); int limitFlyDown = h.CurrentAltitude; h.FlyDown(800); int landFlyDown = h.CurrentAltitude; // Assess Assert.AreEqual(defaultFlyUp, 1000); Assert.AreEqual(flyDown, 800); Assert.AreEqual(limitFlyDown, 800); Assert.AreEqual(landFlyDown, 0); }
private void spawn() { Vector3 refPos = gameManager.map.tilemapManager.transform.position; if (_nextSpawnDistance < gameManager.distance) { int max = 1 + gameManager.distance / 50; max = max <= 0 ? 1 : max; max = max >= 5 ? 5 : max; int min = gameManager.distance / 200; min = min <= 0 ? 1 : min; int N = Random.Range(min, max); bool enableParachute = gameManager.distance > 100; for (int i = 0; i < N; i++) { Vector3 pos = refPos; bool withParachute = false; if (enableParachute) { withParachute = Random.Range(0, 5) > 3; } pos = new Vector3(pos.x + Random.Range(3.0f, 8.0f), 30, gameManager.player.transform.position.z); Soldier e = getAvaliableSoldier(); if (withParachute) { e.parachute.open(); } if (e != null) { Weapon[] weapons = e.GetComponentsInChildren <Weapon>(true); int iWeapon = Random.Range(0, weapons.Length); Weapon w = weapons[iWeapon]; w.fill(); e.reset(); e.transform.position = pos; e.equipWeapon(w); //w.bullet = (Bullet)Resources.LoadAssetAtPath("Assets/Sprite/bullet_for_enemy.prefab", typeof(Bullet)); } } _nextSpawnDistance += Random.Range(3, 10); } if (_nextSpawnHelicopterDistance < gameManager.distance) { Vector3 pos = refPos; pos = new Vector3(pos.x + 50, pos.y, 0); Helicopter e = (Helicopter)Instantiate(prefHelicopter, pos, Quaternion.identity); e.target = gameManager.player.transform; _nextSpawnHelicopterDistance += Random.Range(130, 180); //notice player pos = gameManager.player.transform.position; Transform t = (Transform)Instantiate(prefNotice, pos, Quaternion.identity); Follower f = t.GetComponent <Follower>(); f.target = gameManager.player.transform; } }
public void TestHelicopterConstructor() { //arrange Helicopter h = new Helicopter(); //assert Assert.AreEqual(8000, h.MaxAltitude); }
public HeliAttack(Actor self, Target target, bool attackOnlyVisibleTargets = true) { Target = target; helicopter = self.Trait<Helicopter>(); attackHeli = self.Trait<AttackHeli>(); ammoPools = self.TraitsImplementing<AmmoPool>().ToArray(); this.attackOnlyVisibleTargets = attackOnlyVisibleTargets; }
// Use this for initialization void Start() { player = FindObjectOfType<Player>(); heli = FindObjectOfType<Helicopter>(); spawners.AddRange(GameObject.FindGameObjectsWithTag("zombieSpawner")); lastSpawnTime = Time.time; }
public void Helicopter() { // Act. Helicopter helicopter = kernel.Get <Helicopter>(); // Assert. Assert.IsInstanceOfType(helicopter.Engine, typeof(ReciprocatingEngine)); }
/// <summary> /// Метод, создающий экземпляр вертолёта со случайными значениями. /// </summary> /// <returns>Экземпляр вертолёта со случайными значениями</returns> public Helicopter GenerateHelicopter() { var helicopter = new Helicopter(); GenerateCommonFields(helicopter, 1); helicopter.Mass = _randomInt.Next(100, 999); return(helicopter); }
void PlaceHelicopter(Block b) { b.ObjectPlaced = Instantiate(helicopter, this.transform); Helicopter h = new Helicopter(b.ObjectPlaced); helicopters.Add(h); PlaceHelipad(h, PlacedInQuadNo(b)); }
public PickupUnit(Actor self, Actor cargo) { this.cargo = cargo; carryable = cargo.Trait<Carryable>(); cargoFacing = cargo.Trait<IFacing>(); movement = self.Trait<IMove>(); carryall = self.Trait<Carryall>(); helicopter = self.Trait<Helicopter>(); selfFacing = self.Trait<IFacing>(); state = State.Intercept; }
public static bool AdjustAltitude(Actor self, Helicopter helicopter, WRange targetAltitude) { var altitude = helicopter.CenterPosition.Z; if (altitude == targetAltitude.Range) return false; var delta = helicopter.Info.AltitudeVelocity.Range; var dz = (targetAltitude.Range - altitude).Clamp(-delta, delta); helicopter.SetPosition(self, helicopter.CenterPosition + new WVec(0, 0, dz)); return true; }
public DeliverUnit(Actor self) { carryall = self.Trait<Carryall>(); this.self = self; cargo = carryall.Carrying; movement = self.Trait<IMove>(); carryable = cargo.Trait<Carryable>(); helicopter = self.Trait<Helicopter>(); positionable = cargo.Trait<IPositionable>(); cargoFacing = cargo.Trait<IFacing>(); selfFacing = self.Trait<IFacing>(); state = State.Transport; }
private static void userCode(Helicopter helicopter) { helicopter.TakeOff(); helicopter.ChangeThrottle(600); //put your commands here: //type 'helicopter.' and then see the list of commands you can do. helicopter.MoveForward(2000); helicopter.TurnRight(); helicopter.MoveForward(2000); helicopter.Land(); }
private static void demo(Helicopter helicopter) { //Takeoff command - FLY! helicopter.TakeOff(); //Throttle command - LIFT helicopter.ChangeThrottle(500); //Move forward - watch out im moving forward helicopter.MoveForward(); //Move backward - backing up! helicopter.MoveBackward(2000); //Turn Left - Think about looking out of the helicopter window //helicopter.TurnLeft(); //Turn right - Think about looking out of the helicopter window //helicopter.TurnRight(); //Landing command helicopter.Land(); }
// Use this for initialization void Start() { heli = FindObjectOfType<Helicopter>(); zombieSpawnController = FindObjectOfType<ZombieSpawnController>(); }
void Start() { controls = GameObject.Find("Cube").GetComponent<Helicopter>(); Debug.Log(controls); }
public HeliFly(Actor self, Target t) { helicopter = self.Trait<Helicopter>(); target = t; }
static void Main(string[] args) { Vehicle v = new Vehicle(); v.ModelName = "My Vehicle"; v.MaxSpeed = 180; v.Accelerate(); v.PrintInfo(); v.Brake(); v.PrintInfo(); StreetVehicle sv1= new StreetVehicle(2); sv1.PrintInfo(); //sv1.currentSpeed = 0;//Errore, campo non accessibile Car car = new Car(); car.Accendi(); car.Accelerate(); car.PrintInfo(); Vehicle sv2 = new StreetVehicle(4); //name hiding Airplane airplane = new Airplane(); airplane.TakeOff(); FlyingVehicle vair = airplane; vair.TakeOff(); //virtual override Car ferrari = new Car(); ferrari.Accelerate(); Vehicle vf = ferrari; vf.Accelerate(); //abstract class FlyingVehicle fv = new Helicopter(); //interface ICruiseControl Supercar scar = new Supercar(); scar.SetCruise(90); scar.StartControl(); ICruiseControl sedan = new Sedan(); (sedan as ICruiseControl).SetCruise(90); MyClass mc = new MyClass(); //mc.Bar(); errore, interfaccia esplicita (mc as IFoo).Bar(); //reimplementation Report report = new Report(); report.Print(); SubReport subReport = new SubReport(); subReport.Print(); IDocument irep = report; irep.Print(); IDocument isub = subReport; isub.Print(); irep.Print2(); isub.Print2(); irep.ExPrint(); isub.ExPrint(); irep.ExPrint2(); SpecialSubReport ssub = new SpecialSubReport(); IDocument issub = ssub; issub.ExPrint2(); //IComparable objects sorting ArrayList list = new ArrayList(); list.Add(new ComparableCar() { Targa = "DE234QW" }); list.Add(new ComparableCar() { Targa = "CP787MC" }); list.Add(new ComparableCar() { Targa = "BM41329" }); list.Sort(); //Abstract classes and interface MyDoc doc = new MyDoc(); doc.Print(); doc.Save(); }
public HeliReturn(Actor self) { aircraftInfo = self.Info.Traits.Get<AircraftInfo>(); heli = self.Trait<Helicopter>(); heliInfo = self.Info.Traits.Get<HelicopterInfo>(); }
private void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } instance = this; // DontDestroyOnLoad(this.gameObject); }
public HeliFlyCircle(Actor self) { helicopter = self.Trait<Helicopter>(); }