Ejemplo n.º 1
0
        public List <string> Validate()
        {
            var errors = new List <string>();

            if (!PlanetStatus.Equals(PlanetStatus.Habitable) && !PlanetStatus.Equals(PlanetStatus.Uninhabitable))
            {
                return(errors);
            }

            if (SpinFrequency < 0)
            {
                errors.Add("A planet can't have a spin Frequency < 0");
            }
            if (GravityForce < 0)
            {
                errors.Add("A planet can't have a Gravity Force < 0 m/s^2");
            }
            if (PlanetRadius < 0)
            {
                errors.Add("A planet can't have a Radius < 0");
            }
            if (PlanetSurfaceMagneticField < 0)
            {
                errors.Add("A planet can't have a Magnetic Field <= 0 A/m");
            }
            if (AverageSolarWindVelocity < 0)
            {
                errors.Add("A planet can't have a Solar Wind Velocity < 0 KM/S");
            }

            return(errors);
        }
Ejemplo n.º 2
0
 void releasedHandler(object sender, System.EventArgs e)
 {
     if (status != PlanetStatus.Manual)
     {
         return;
     }
     status = PlanetStatus.Free;
 }
Ejemplo n.º 3
0
        public void Fall()
        {
            status = PlanetStatus.Falling;
            var gesture = GetComponent <TransformGesture>();

            if (gesture != null)
            {
                gesture.Cancel();
            }
        }
Ejemplo n.º 4
0
 public void updateRocketReloadingCooldown()
 {
     if (currentReloadCooldown < 0)
     {
         currentStatus = PlanetStatus.readyToShoot;
     }
     else
     {
         currentReloadCooldown -= Time.deltaTime;
         currentStatus          = PlanetStatus.reloading;
     }
 }
Ejemplo n.º 5
0
 //must be colled from controller
 public void Command_Shoot()
 {
     if (GameManager.gameStatus != GameStatus.Running || currentStatus != PlanetStatus.readyToShoot)
     {
         return;
     }
     if (rocketObj.GetComponent <RocketManager>().Initialized == false)
     {
         return;
     }
     if (rocketObj == null)
     {
         Debug.LogError("Ooops, Rocket not found.");
         return;
     }
     currentStatus = PlanetStatus.reloading;
     rocketObj.GetComponent <RocketManager>().ShootRequested();
     currentReloadCooldown      = rocketReloadCooldown;
     rocketObj.transform.parent = null;
     rocketObj = null;
 }
Ejemplo n.º 6
0
 void pressedhandler(object sender, System.EventArgs e)
 {
     status = PlanetStatus.Manual;
 }
Ejemplo n.º 7
0
 void releasedHandler(object sender, System.EventArgs e)
 {
     if (status != PlanetStatus.Manual) return;
     status = PlanetStatus.Free;
 }
Ejemplo n.º 8
0
 void pressedhandler(object sender, System.EventArgs e)
 {
     status = PlanetStatus.Manual;
 }
Ejemplo n.º 9
0
 public void Fall()
 {
     status = PlanetStatus.Falling;
     var gesture = GetComponent<TransformGesture>();
     if (gesture != null) gesture.Cancel();
 }
Ejemplo n.º 10
0
 //Must be called from Rocket which was hit in ReadyMode
 public void rocketDestroyed()
 {
     currentStatus         = PlanetStatus.reloading;
     currentReloadCooldown = rocketReloadCooldown;
     rocketObj             = null;
 }