Exemplo n.º 1
0
        static void Main(string[] args)
        {
            FlyingMachine Amy = new FlyingMachine();
            // neshtoto ot lqvo poluchava stoinostta ot dqsno
            //int planeti = 9;
            //(a ne ) 9 = planeti;
            Amy.battery = 4000;
            Amy.controller = Controllers.Edisson;
            Amy.frame = Frames.Alluminium;
            Amy.motors = 2;

            Drone Valio = new Drone();
            Valio.battery = 4011;
            Valio.controller = Controllers.Flyver;
            Valio.frame = Frames.Carbon;
            Valio.motors = 4;
            Valio.propellers = 4;
            //valio ima nova kamera
            Valio.camera = new Camera();
            // modela na kamerata na valio e hero4
            Valio.camera.model = GoPro.Hero4;
            Valio.camera.mp = 20;
            Valio.camera.fisheyeIncluded = true;
            Valio.camera.zoom = 3;
            Valio.camera.videoIncluded = true;
        }
Exemplo n.º 2
0
 public List <Drone> createList()
 {
     _connectionString.Server   = "192.168.137.5";
     _connectionString.UserID   = "Bois";
     _connectionString.Password = "******";
     _connectionString.Database = "drones";
     _connection = new MySqlConnection(_connectionString.ToString());
     _connection.Open();
     _command = new MySqlCommand("SELECT id FROM drones", _connection);
     Debug.Log("Connection state:" + _connection.State);
     _reader = _command.ExecuteReader();
     while (_reader.Read())
     {
         drone          = new Drone();
         drone.id       = _reader["id"].ToString();
         drone.droneNum = _uniqueNum++;
         drones.Add(drone);
         droneCount++;
     }
     _connection.Close();
     _reader.Close();
     return(drones);
 }
Exemplo n.º 3
0
 public void AssignDrone(Drone drone) => _Data.drone         = drone.UID;
Exemplo n.º 4
0
 public Battery(Drone drone, Hub hub)
 {
     _Data = new BatteryData();
     AssignDrone(drone);
     AssignHub(hub);
 }
 public void addtoDroneList(Drone drone)
 {
     drones.Add(drone);
 }
Exemplo n.º 6
0
        public bool RemoveDrone(string name)
        {
            Drone drone = Drones.FirstOrDefault(a => a.Name == name);

            return(Drones.Remove(drone));
        }
Exemplo n.º 7
0
 public RetiredDrone(Drone drone)
 {
     _Data = new RetiredDroneData(drone);
     ConsoleLog.WriteToConsole(new DroneRetired(this));
 }
Exemplo n.º 8
0
 public RetiredDrone(Drone drone, Collider other)
 {
     _Data = new RetiredDroneData(drone, other);
     ConsoleLog.WriteToConsole(new DroneCollision(this));
 }
Exemplo n.º 9
0
 public void AddToDeploymentQueue(Drone drone) => _Data.deploymentQueue.Enqueue(drone);
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            // Initialize the repository (Airfield)
            Airfield airfield = new Airfield("Heathrow", 10, 10.5);

            // Initialize entity
            Drone drone = new Drone("D20", "DEERC", 6);

            //Print Drone
            Console.WriteLine(drone);
            // Drone: D20
            // Manufactured by: DEERC
            // Range: 6 kilometers

            // Add Drone
            Console.WriteLine(airfield.AddDrone(drone)); // Successfully added D20 to the airfield.
            Console.WriteLine(airfield.Count);           // 1

            // Remove Drone
            Console.WriteLine(airfield.RemoveDrone("DE51"));  // False

            Drone secondDrone = new Drone("CW4", "Cheerwing", 8);
            Drone thirdDrone  = new Drone("X5SW-V3", "Cheerwing", 7);
            Drone fourthDrone = new Drone("X20", "Cheerwing", 4);
            Drone fifthDrone  = new Drone("EVO2", "Autel", 10);
            Drone sixtDrone   = new Drone("XL5-6S-FPV", "iFlight", 10);

            // Add Drones
            Console.WriteLine(airfield.AddDrone(secondDrone)); // Successfully added CW4 to the airfield.
            Console.WriteLine(airfield.AddDrone(thirdDrone));  // Successfully added X5SW-V3 to the airfield.
            Console.WriteLine(airfield.AddDrone(fourthDrone)); // Invalid drone.
            Console.WriteLine(airfield.AddDrone(fifthDrone));  // Successfully added EVO2 to the airfield.
            Console.WriteLine(airfield.AddDrone(sixtDrone));   // Successfully added XL5-6S-FPV to the airfield.

            // Fly drone by name
            Console.WriteLine(airfield.FlyDrone("CW4"));
            // Drone: CW4
            // Manufactured by: Cheerwing
            // Range: 8 kilometers

            Console.WriteLine("-----------------FlyDronesByRange-----------------");
            List <Drone> flyDrones = airfield.FlyDronesByRange(10);

            foreach (var droneToFly in flyDrones)
            {
                Console.WriteLine(droneToFly);
            }

            /*
             * Drone: EVO2
             * Manufactured by: Autel
             * Range: 10 kilometers
             * Drone: XL5-6S-FPV
             * Manufactured by: iFlight
             * Range: 10 kilometers
             */

            // Remove drone by brand
            Console.WriteLine(airfield.RemoveDroneByBrand("Cheerwing")); // 2

            Console.WriteLine("----------------------Report----------------------");
            Console.WriteLine(airfield.Report());

            /*
             * Drones available at Heathrow:
             * Drone: D20
             * Manufactured by: DEERC
             * Range: 6 kilometers
             */
        }