-
-
Save fitomad/db1a6df6ddbf1fb3215b1e9a100b4678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct AirRover | |
{ | |
/// | |
public var altitude: Double | |
/// | |
public private(set) var name: String | |
/// | |
public private(set) var batteryLevel: Int | |
/// | |
public private(set) var speed: Double | |
/** | |
*/ | |
public func takeLanding() -> Void | |
{ | |
print("En tierra") | |
} | |
/** | |
Altura mínima a la que debe volar el Rover para no chocar con ningún | |
accidente geográfico. | |
*/ | |
private func checkMinimunAltitude(from origin: CLLocation, to destination: CLLocation) -> Double | |
{ | |
// Parece que vamos a sobrevolar el Monte Olimpo | |
return 22_500.0 | |
} | |
} | |
extension AirRover: Rover | |
{ | |
/** | |
*/ | |
public init(named name: String) | |
{ | |
self.name = name | |
self.batteryLevel = 100 | |
self.speed = 0.0 | |
self.altitude = 0.0 | |
} | |
public func move(to position: CLLocation) -> Bool | |
{ | |
// Siempre podemos movernos ;-) | |
return true | |
} | |
public func stop() -> Void | |
{ | |
self.takeLanding() | |
} | |
public func hibernate() -> Void | |
{ | |
self.takeLanding() | |
self.stop() | |
} | |
public func startExperiment() -> Void | |
{ | |
print("Aspirando polvo en suspensión de las capas alta de la atmósfera") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment