Пример #1
0
        public SDrone(DroneData data, Drone drone)
        {
            count = DroneData.Count;
            uid   = data.UID;
            totalDeliveryCount = data.DeliveryCount;
            totalBatterySwaps  = data.batterySwaps;
            totalHubHandovers  = data.hubsAssigned;
            collisionOn        = data.collisionOn;
            isWaiting          = data.isWaiting;
            inHub                  = data.inHub;
            movement               = data.movement;
            status                 = data.state;
            totalDelay             = data.totalDelay;
            totalAudibleDuration   = data.audibleDuration;
            totalPackageWeight     = data.packageWeight;
            totalDistanceTravelled = data.distanceTravelled;
            totalEnergy            = data.totalEnergy;
            targetAltitude         = data.targetAltitude;
            waypointsQueue         = new List <SVector3>();
            completedJobs          = new List <uint>(data.completedJobs.Keys);
            maxSpeed               = data.MaxSpeed;
            position               = drone.transform.position;
            previousWaypoint       = data.previousWaypoint;
            waypoint               = data.currentWaypoint;
            job     = data.job;
            hub     = data.hub;
            battery = data.battery;
            charge  = drone.GetBattery().Charge;

            foreach (var point in data.waypoints)
            {
                waypointsQueue.Add(point);
            }
        }
Пример #2
0
 public SNoFlyZone(NFZData data)
 {
     uid         = data.UID;
     count       = NFZData.Count;
     droneEntry  = data.droneEntryCount;
     hubEntry    = data.hubEntryCount;
     position    = data.Position;
     orientation = data.Orientation;
     size        = data.Size;
 }
Пример #3
0
 public SJob(JobData data)
 {
     uid           = data.UID;
     packageWeight = data.packageWeight;
     costFunction  = data.costFunction?.Serialize();
     completedOn   = data.completed?.Serialize();
     deadline      = data.deadline?.Serialize();
     status        = data.status;
     pickup        = data.pickup;
     destination   = data.dropoff;
     droneUID      = data.drone;
 }
Пример #4
0
 public SRetiredDrone(RetiredDroneData data)
 {
     uid = data.UID;
     isDroneCollision = data.isDroneCollision;
     hub            = data.hub;
     assignedJob    = data.job;
     packageworth   = data.packageWorth;
     destroyed      = data.destroyedTime.Serialize();
     waypoint       = data.waypoint;
     location       = data.collisionLocation;
     completedJobs  = new List <uint>();
     otherDroneName = data.otherDrone;
     otherUID       = data.otherUID;
     charge         = data.batteryCharge;
     foreach (var job in data.completedJobs.Keys)
     {
         completedJobs.Add(job);
     }
 }
Пример #5
0
        public StaticObstacle(Transform t)
        {
            position    = t.position;
            size        = t.localScale;
            orientation = t.eulerAngles;
            position.y  = 0;
            dx          = RotationY(orientation.y) * Vector3.right * size.x / 2;
            dz          = RotationY(orientation.y) * Vector3.forward * size.z / 2;
            diag        = new Vector2(size.x, size.z).magnitude;
            normals     = new SVector3[4];
            verts       = new SVector3[4];
            normals[0]  = ((Vector3)dz).normalized;
            normals[1]  = ((Vector3)dx).normalized;
            normals[2]  = -(Vector3)normals[0];
            normals[3]  = -(Vector3)normals[1];

            verts[0] = (Vector3)position + dz + dx; // ij
            verts[1] = (Vector3)position - dz + dx; // jk
            verts[2] = (Vector3)position - dz - dx; // kl
            verts[3] = (Vector3)position + dz - dx; // li
        }
Пример #6
0
        public SHub(HubData data, Hub hub)
        {
            count             = HubData.Count;
            uid               = data.UID;
            batteries         = new List <uint>();
            freeBatteries     = new List <uint>();
            chargingBatteries = new List <uint>();
            drones            = new List <uint>();
            freeDrones        = new List <uint>();
            position          = hub.transform.position;
            exitingDrones     = new List <uint>();
            energy            = data.energyConsumption;

            foreach (var bat in data.batteries.Keys)
            {
                batteries.Add(bat);
            }
            foreach (var bat in data.freeBatteries.Keys)
            {
                freeBatteries.Add(bat);
            }
            foreach (var bat in data.chargingBatteries.Keys)
            {
                chargingBatteries.Add(bat);
            }
            foreach (var d in data.drones.Keys)
            {
                drones.Add(d);
            }
            foreach (var d in data.freeDrones.Keys)
            {
                freeDrones.Add(d);
            }
            foreach (var d in data.deploymentQueue)
            {
                exitingDrones.Add(d.UID);
            }
        }
Пример #7
0
        public StrippedDrone(DroneData data, Drone drone)
        {
            uid              = data.UID;
            isWaiting        = data.isWaiting;
            inHub            = data.inHub;
            movement         = data.movement;
            status           = data.state;
            targetAltitude   = data.targetAltitude;
            waypointsQueue   = new List <SVector3>();
            maxSpeed         = data.MaxSpeed;
            position         = drone.transform.position;
            previousWaypoint = data.previousWaypoint;
            waypoint         = data.currentWaypoint;
            job              = data.job;
            hub              = data.hub;
            battery          = data.battery;
            charge           = drone.GetBattery().Charge;

            foreach (var point in data.waypoints)
            {
                waypointsQueue.Add(point);
            }
        }