Esempio n. 1
0
        public string GetPlanetName(PlanetName planetName)
        {
            switch (planetName)
            {
            case PlanetName.Earth:
                return("Earth");

            case PlanetName.AlphaCentauri:
                return("Alpha Centauri");

            case PlanetName.Barrie:
                return("Barrie");

            case PlanetName.M63:
                return("M63");

            case PlanetName.NewfoundAlien:
                return("Newfound Alien");

            case PlanetName.Pluto:
                return("Pluto");

            case PlanetName.Kelt:
                return("Kelt");

            case PlanetName.StarGaze:
                return("Star Gaze");

            default:
                return("");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Calculates ecliptical coordinates of the planet.
        /// </summary>
        /// <returns>
        /// The ecliptic longitude of the planet as seen from the Sun.
        /// </returns>
        /// <param name="planetName">Solar System planet name.</param>
        /// <param name="date">Date.</param>
        public static double getEclipticalCoordinates(PlanetName planetName, DateTime date)
        {
            Planet planet = getPlanet(planetName);
            double eclLng = GetMeanAnomaly(planetName, date) + planet.P + 180 + GetEquationOfCenter(planetName, date);

            return(Math.Round(eclLng % 360, 4));
        }
Esempio n. 3
0
    // public Camera cam;

    // Start is called before the first frame update
    void Awake()
    {
        while (!Input.location.isEnabledByUser)
        {
            Permission.RequestUserPermission(Permission.CoarseLocation);
        }
        StartCoroutine(StartLocation());

        var        planetName     = this.name.Replace("(Clone)", "");
        PlanetName planet         = (PlanetName)Enum.Parse(typeof(PlanetName), planetName.ToUpper());
        Vector3    planetLocation = CelestialCoordinates.CalculateHorizontalCoordinatesPlanets(lat, lon, planet, DateTime.Now);

        Vector3 cartesianLocation = Quaternion.Euler(-planetLocation.x, planetLocation.y, 0) * new Vector3(0, 0, planetLocation.z);


        //float x = (float)(planetLocation.z * Math.Cos(planetLocation.x) * Math.Cos(planetLocation.y));
        //float y = (float)(planetLocation.z * Math.Cos(planetLocation.x) * Math.Sin(planetLocation.y));
        //float z = (float)(planetLocation.z * Math.Sin(planetLocation.x));

        //Vector3 cartesianLocation = new Vector3(x, y, z);
        while (Vector3.Distance(cartesianLocation, Vector3.zero) > 1.5)
        {
            cartesianLocation = Vector3.MoveTowards(cartesianLocation, Vector3.zero, 1);
        }
        this.transform.position = cartesianLocation;


        // ---------------This doesn't have to be on every place as the planets are loaded in each phone... ?
        GameObject.Find("DebugCanvas").GetComponent <Text>().text += $"Planet {planet} loaded at {cartesianLocation} \n";
    }
Esempio n. 4
0
    public void Show(string title, string message, Color color, PlanetName planet, Action callback = null, bool correct = false)
    {
        Title.text   = title;
        Message.text = message;
        Accent.color = color;
        Callback     = callback;
        LayoutRebuilder.MarkLayoutForRebuild(rect);
        UIBlurControl.Instance.SetBlurVisibility(true);
        planetWinRing.SetVisibility(false);

        if (correct)
        {
            wrongGroup.alpha = 0f;

            animIcon.SetVisibility(true);
            animIcon.InitIcon(planet);
        }
        else
        {
            wrongGroup.alpha = 1f;
            animIcon.SetVisibility(false);
        }

        base.Show();
    }
Esempio n. 5
0
    void UIPlanetIcon_OnClick(PlanetName planet)
    {
        bool   collected = PlanetTray.Instance[planet].Collected;
        string location  = "Location:\n\n" + TriviaManager.Instance[planet].location_hint;

        PopupPanel.Instance.Show(planet.ToString(), collected ? PlanetInfo.Info[planet] : location, collected ? PlanetInfo.Colors[planet] : Color.grey);
    }
Esempio n. 6
0
        private Coordinate GetCoordinates(PlanetName planetName)
        {
            switch (planetName)
            {
            case PlanetName.Earth:
                return(new Coordinate(0, 0));

            case PlanetName.AlphaCentauri:
                return(new Coordinate(0, -4.367));

            case PlanetName.Barrie:
                return(new Coordinate(-4.6, 5));

            case PlanetName.M63:
                return(new Coordinate(1657, 1745));

            case PlanetName.NewfoundAlien:
                return(new Coordinate(2787, -2500));

            case PlanetName.Pluto:
                return(new Coordinate(-100, 180));

            case PlanetName.Kelt:
                return(new Coordinate(-623, 841));

            case PlanetName.StarGaze:
                return(new Coordinate(1087, -412));

            default:
                return(new Coordinate(-1, -1));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Calculates the sidereal time of the planet.
        /// </summary>
        /// <returns>
        /// The sidereal time of the planet.
        /// </returns>
        /// <param name="planetName">Solar System planet name.</param>
        /// <param name="date">Date.</param>
        /// <param name="lw">Longtitude of the location.</param>
        public static double GetSiderealTime(PlanetName planetName, DateTime date, double lw)
        {
            Planet planet = getPlanet(planetName);

            double calcDate = BaseCalculator.ToDays(date),
                   theta    = planet.Theta0 + planet.Theta1 * calcDate - lw;

            return(Math.Round(theta % 360, 4));
        }
Esempio n. 8
0
    public void PlanetCollected(PlanetName planet)
    {
        this[planet].SetCollected(true);

        if (CollectedAllPlanets())
        {
            OnCollectedAllPlanets?.Invoke();
        }
    }
Esempio n. 9
0
    public void InitIcon(PlanetName planet)
    {
        currentPlanet = planet;

        outlineSprite   = UIPlanetIcon.GetOutlineSprite(planet);
        collectedSprite = UIPlanetIcon.GetCollectedSprite(planet);

        DoAnimation();
    }
Esempio n. 10
0
        /// <summary>
        /// Calculates the mean anomaly of the planet.
        /// </summary>
        /// <returns>
        /// The mean anomaly of the planet.
        /// </returns>
        /// <param name="planetName">Solar System planet name.</param>
        /// <param name="date">Date.</param>
        public static double GetMeanAnomaly(PlanetName planetName, DateTime date)
        {
            Planet planet = getPlanet(planetName);

            double calcDate = BaseCalculator.ToDays(date),
                   M        = planet.M0 + planet.M1 * calcDate;

            return(Math.Round(M % 360, 4));
        }
Esempio n. 11
0
    public void PlanetScanned(PlanetName planet)
    {
        if (!PlanetTray.Instance[planet].Collected)
        {
            TriviaPanel.Instance.Show(planet);
        }

        //else
        //	PopupPanel.Instance.Show(planet.ToString(), "You've already collected this planet!\nWow!", PlanetInfo.Colors[planet]);
    }
Esempio n. 12
0
        /// <summary>
        /// Calculates the equation of center of the planet.
        /// </summary>
        /// <returns>
        /// The difference between the true anomaly and the mean anomaly.
        /// </returns>
        /// <param name="planetName">Solar System planet name.</param>
        /// <param name="date">Date.</param>
        public static double GetEquationOfCenter(PlanetName planetName, DateTime date)
        {
            Planet planet = getPlanet(planetName);

            double M = GetMeanAnomaly(planetName, date) * BaseCalculator.rad;

            double eq = planet.C1 * Math.Sin(M) + planet.C2 * Math.Sin(2 * M) + planet.C3 * Math.Sin(3 * M) +
                        planet.C4 * Math.Sin(4 * M) + planet.C5 * Math.Sin(5 * M) + planet.C6 * Math.Sin(6 * M);

            return(Math.Round(eq, 4));
        }
Esempio n. 13
0
 public IPlanet GetPlanet(PlanetName name)
 {
     foreach (IPlanet p in Planets)
     {
         if (p.Name == name)
         {
             return(p);
         }
     }
     return(null);
 }
Esempio n. 14
0
 public void PlanetOptions()
 {
     "Planet: ".Write();
     PlanetName.Write(PlanetNameCColor);
     " Natural resource available to mine: ".Write();
     PlanetResource.WriteLine(PlanetResourceCColor);
     "[1] Store".WriteLine();
     "[2] Mine".WriteLine();
     "[3] Travel".WriteLine();
     "[4] Save Game".WriteLine();
     "[5] Quit".WriteLine();
 }
Esempio n. 15
0
        /// <summary>
        /// Calculates equatorial coordinates of the planet.
        /// </summary>
        /// <returns>
        /// The right ascension and the declination of the planet.
        /// </returns>
        /// <param name="planetName">Solar System planet name.</param>
        /// <param name="date">Date.</param>
        public static Tuple <double, double> GetEquatorialCoordinates(PlanetName planetName, DateTime date)
        {
            Planet planet = getPlanet(planetName);

            double eclLng = getEclipticalCoordinates(planetName, date) * BaseCalculator.rad,
                   eps    = planet.Eps * BaseCalculator.rad;

            // right ascension
            double alpha = Math.Atan2(Math.Sin(eclLng) * Math.Cos(eps), Math.Cos(eclLng)) / BaseCalculator.rad;

            // declination
            double delta = Math.Asin(Math.Sin(eclLng) * Math.Sin(eps)) / BaseCalculator.rad;

            return(new Tuple <double, double>(Math.Round(alpha, 4), Math.Round(delta, 4)));
        }
Esempio n. 16
0
    public void Show(PlanetName planet)
    {
        currentPlanet = planet;
        currentTrivia = TriviaManager.Instance[planet];

        questionText.text = currentTrivia.question;
        titleText.text    = planet.ToString();
        titleAccent.color = PlanetInfo.Colors[planet];

        for (int i = 0; i < answerList.Count; i++)
        {
            UIAnswerElement element = answerList[i];
            element.SetInfo(currentTrivia.answers[i], PlanetInfo.Colors[planet]);
        }

        SetVisibility(true);
    }
Esempio n. 17
0
 /// <summary>
 /// Creates an instance of the planet.
 /// </summary>
 public Planet(PlanetName name, double m0, double m1, double theta0, double theta1,
               double c1, double c2, double c3, double c4, double c5, double c6, double p, double eps)
 {
     Name   = name;
     M0     = m0;
     M1     = m1;
     Theta0 = theta0;
     Theta1 = theta1;
     C1     = c1;
     C2     = c2;
     C3     = c3;
     C4     = c4;
     C5     = c5;
     C6     = c6;
     P      = p;
     Eps    = eps;
 }
Esempio n. 18
0
 public Planet(PlanetName planetName)
 {
     Name        = GetPlanetName(planetName);
     ItemList    = GenerateItems(planetName);
     Coordinates = GetCoordinates(planetName);
 }
Esempio n. 19
0
 void OnCorrectAnswerSelected(PlanetName planet)
 {
     PlanetTray.Instance.PlanetCollected(planet);
     OnPlanetCollected?.Invoke(planet);
 }
Esempio n. 20
0
        private List <Item> GenerateItems(PlanetName planetName)
        {
            switch (planetName)
            {
            case PlanetName.Earth:
                return(new List <Item>
                {
                    new Item("Rocks", 100, 1, 100),
                    new Item("Diamonds", 200, 1, 200)
                });

            case PlanetName.AlphaCentauri:
                return(new List <Item>
                {
                    new Item("Orbs", 150, 1, 150),
                    new Item("Plasma", 300, 1, 300)
                });

            case PlanetName.Barrie:
                return(new List <Item>
                {
                    new Item("Metal", 500, 1, 500),
                    new Item("Ions", 1000, 1, 1000)
                });

            case PlanetName.M63:
                return(new List <Item>
                {
                    new Item("Dark Matter", 700, 1, 700),
                    new Item("Laser Rifles", 1500, 1, 1500)
                });

            case PlanetName.NewfoundAlien:
                return(new List <Item>
                {
                    new Item("Space Flower", 2000, 1, 2000),
                    new Item("Space Beer", 2500, 1, 2500)
                });

            case PlanetName.Pluto:
                return(new List <Item>
                {
                    new Item("Alien Robot", 1200, 1, 1200),
                    new Item("Plutonium", 2500, 1, 2500)
                });

            case PlanetName.Kelt:
                return(new List <Item>
                {
                    new Item("One Mans Trash", 1500, 1, 1500),
                    new Item("Molten Lava Droplet", 2800, 1, 2800)
                });

            case PlanetName.StarGaze:
                return(new List <Item>
                {
                    new Item("Medeorite Dust", 2000, 1, 2000),
                    new Item("Starlight Elixer", 4000, 1, 4000)
                });

            default:
                return(null);
            }
            ;
        }
Esempio n. 21
0
 private void Awake()
 {
     planetName    = this;
     textName.text = "";
 }
Esempio n. 22
0
 public static PlanetType GetType(PlanetName name)
 {
     return(planetSettingsStat.Find((p) => p.planetName == name));
 }
Esempio n. 23
0
 public UIPlanetIcon this[PlanetName planet]
 {
     get => Icons.Where(i => i.PlanetName == planet).First();
Esempio n. 24
0
 public bool IsCollected(PlanetName planet)
 {
     return(this[planet].Collected);
 }
Esempio n. 25
0
    /// <summary>
    /// Calculate the altitude and azimuth of all planets of our solar system / including sun.
    /// Source: http://www.abecedarical.com/javascript/script_planet_orbits.html
    /// </summary>
    /// <returns>The altitude azimuth (in degree) as well as the distance of where the star is located (in AU)</returns>
    /// <param name="_longitude">User longitude in degree</param>
    /// <param name="_latitude">User latitude in degree</param>
    /// <param name="_name">The planet's name</param>
    /// <param name="_time">The time in UTC</param>
    public static Vector3 CalculateHorizontalCoordinatesPlanets(double _longitude, double _latitude, PlanetName _name, DateTime _time)
    {
        //Convert the latitude to radians
        _latitude *= Mathf.Deg2Rad;

        Vector3 coordinates = new Vector3(0, 0, 0);

        //1. Days elapsed since J2000 (1st january 2000 at 12:00)
        DateTime epoch   = new DateTime(2000, 1, 1, 12, 0, 0);
        TimeSpan j2000TS = _time - epoch;
        double   j2000   = j2000TS.TotalDays;

        //2. Centuries since J2000
        double cJ2000 = j2000 / 36525.0f;

        //3. Depending on the planet, sets its parameters that we use later to calculate Alt + Az
        double inclination  = 0f;   //angle between the plane of the ecliptic (the plane of Earth's orbit about the Sun) and the plane of the planets orbit
        double longNode     = 0f;   //longitude of ascending node (degrees), the position in the orbit where the elliptical path of the planet passes through the plane of the ecliptic, from below the plane to above the plane
        double longPeri     = 0f;   //longitude of perihelion (degrees), the position in the orbit where the planet is closest to the Sun
        double meanDist     = 0f;   //mean distance (AU), the value of the semi-major axis of the orbit (AU - Astronomical Unit - average Sun to Earth distance)
        double eccentricity = 0f;   //eccentricity of the ellipse which describes the orbit (dimensionless)
        double meanLong     = 0f;   //mean longitude (degrees), the position of the planet in the orbit

        //In all cases save these variable for the Earth as well...which uses the same equation as the Sun!
        double inclinationE   = (0.00005f - 46.94f * cJ2000 / 3600.0f) * Mathf.Deg2Rad;;
        double longNodeE      = (-11.26064f - 18228.25f * cJ2000 / 3600.0f) * Mathf.Deg2Rad;;
        double longPeriE      = (102.94719f + 1198.28f * cJ2000 / 3600.0f) * Mathf.Deg2Rad;
        double meanDistE      = 1.00000011f - 0.00000005f * cJ2000;
        double eccenctricityE = 0.01671022f - 0.00003804f * cJ2000;
        double meanLongE      = Mod2Pi((100.46435f + 129597740.63f * cJ2000 / 3600.0f) * Mathf.Deg2Rad);

        switch (_name)
        {
        case PlanetName.SUN:
            inclination  = inclinationE;
            longNode     = longNodeE;
            longPeri     = longPeriE;
            meanDist     = meanDistE;
            eccentricity = eccenctricityE;
            meanLong     = meanLongE;
            break;

        case PlanetName.MERCURY:
            inclination  = (7.00487f - 23.51f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (48.33167f - 446.30f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (77.45645f + 573.57f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 0.38709893f + 0.00000066f * cJ2000;
            eccentricity = 0.20563069f + 0.00002527f * cJ2000;
            meanLong     = Mod2Pi((252.25084f + 538101628.29f * cJ2000 / 3600.0f) * Mathf.Deg2Rad);
            break;

        case PlanetName.VENUS:
            inclination  = (3.39471f - 2.86f * cJ2000 / 3600.0f) * Mathf.Deg2Rad;
            longNode     = (76.68069f - 996.89f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (131.53298f - 108.80f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 0.72333199f + 0.00000092f * cJ2000;
            eccentricity = 0.00677323f - 0.00004938f * cJ2000;
            meanLong     = Mod2Pi((181.97973f + 210664136.06f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;

        case PlanetName.MARS:
            inclination  = (1.85061f - 25.47f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (49.57854f - 1020.19f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (336.04084f + 1560.78f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 1.52366231f - 0.00007221f * cJ2000;
            eccentricity = 0.09341233f + 0.00011902f * cJ2000;
            meanLong     = Mod2Pi((355.45332f + 68905103.78f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;

        case PlanetName.JUPITER:
            inclination  = (1.30530f - 4.15f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (100.55615f + 1217.17f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (14.75385f + 839.93f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 5.20336301f + 0.00060737f * cJ2000;
            eccentricity = 0.04839266f - 0.00012880f * cJ2000;
            meanLong     = Mod2Pi((34.40438f + 10925078.35f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;

        case PlanetName.SATURN:
            inclination  = (2.48446f + 6.11f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (113.71504f - 1591.05f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (92.43194f - 1948.89f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 9.53707032f - 0.00301530f * cJ2000;
            eccentricity = 0.05415060f - 0.00036762f * cJ2000;
            meanLong     = Mod2Pi((49.94432f + 4401052.95f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;

        case PlanetName.URANUS:
            inclination  = (0.76986f - 2.09f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (74.22988f - 1681.40f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (170.96424f + 1312.56f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 19.19126393f + 0.00152025f * cJ2000;
            eccentricity = 0.04716771f - 0.00019150f * cJ2000;
            meanLong     = Mod2Pi((313.23218f + 1542547.79f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;

        case PlanetName.NEPTUNE:
            inclination  = (1.76917f - 3.64f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (131.72169f - 151.25f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (44.97135f - 844.43f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 30.06896348f - 0.00125196f * cJ2000;
            eccentricity = 0.00858587f + 0.00002510f * cJ2000;
            meanLong     = Mod2Pi((304.88003f + 786449.21f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;

        case PlanetName.PLUTO:
            inclination  = (17.14175f + 11.07f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longNode     = (110.30347f - 37.33f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            longPeri     = (224.06676f - 132.25f * cJ2000 / 3600f) * Mathf.Deg2Rad;
            meanDist     = 39.48168677f - 0.00076912f * cJ2000;
            eccentricity = 0.24880766f + 0.00006465f * cJ2000;
            meanLong     = Mod2Pi((238.92881f + 522747.90f * cJ2000 / 3600f) * Mathf.Deg2Rad);
            break;
        }

        //Position of Earth in its orbit
        double me          = Mod2Pi(meanLongE - longPeriE);
        double ve          = TrueAnomaly(me, eccenctricityE);
        double pEarthOrbit = meanDistE * (1 - eccenctricityE * eccenctricityE) / (1 + eccenctricityE * Math.Cos(ve));

        //Heliocentric rectangular coordinates of Earth
        double xe = pEarthOrbit * Math.Cos(ve + longPeriE);
        double ye = pEarthOrbit * Math.Sin(ve + longPeriE);
        double ze = 0.0f;

        //Position of planet in its orbit
        double mp           = Mod2Pi(meanLong - longPeri);
        double vp           = TrueAnomaly(mp, eccentricity);
        double pPlanetOrbit = meanDist * (1 - eccentricity * eccentricity) / (1 + eccentricity * Math.Cos(vp));

        //Heliocentric rectangular coordinates of planets
        double xh = pPlanetOrbit * (Math.Cos(longNode) * Math.Cos(vp + longPeri - longNode) - Math.Sin(longNode) * Math.Sin(vp + longPeri - longNode) * Math.Cos(inclination));
        double yh = pPlanetOrbit * (Math.Sin(longNode) * Math.Cos(vp + longPeri - longNode) + Math.Cos(longNode) * Math.Sin(vp + longPeri - longNode) * Math.Cos(inclination));
        double zh = pPlanetOrbit * (Math.Sin(vp + longPeri - longNode) * Math.Sin(inclination));

        //If Sun set the coordinates to 0
        if (_name == PlanetName.SUN)
        {
            xh = 0f;
            yh = 0f;
            zh = 0f;
        }

        //Convert to geocentric rectangular coordinates
        double xg = xh - xe;
        double yg = yh - ye;
        double zg = zh - ze;

        // rotate around x axis from ecliptic to equatorial coords
        double ecl = 23.439281f * Mathf.Deg2Rad;
        double xeq = xg;
        double yeq = yg * Math.Cos(ecl) - zg * Math.Sin(ecl);
        double zeq = yg * Math.Sin(ecl) + zg * Math.Cos(ecl);

        // find the RA and DEC from the rectangular equatorial coords
        double ra       = Mod2Pi(Math.Atan2(yeq, xeq)) * Mathf.Rad2Deg;
        double dec      = Math.Atan(zeq / Math.Sqrt(xeq * xeq + yeq * yeq)) * Mathf.Rad2Deg;
        double distance = Math.Sqrt(xeq * xeq + yeq * yeq + zeq * zeq);

        //Now that we have the Right Ascension and the declination of the planet, we can get the Altitude and Azimuth!
        //compute hour angle in degrees
        // mean sidereal time
        double MST = 280.46061837f + 360.98564736629f * j2000 + 0.000387933f * cJ2000 * cJ2000 - cJ2000 * cJ2000 * cJ2000 / 38710000f + _longitude;

        if (MST > 0.0f)
        {
            while (MST > 360.0f)
            {
                MST -= 360.0f;
            }
        }
        else
        {
            while (MST < 0.0f)
            {
                MST = MST + 360.0;
            }
        }

        //Compute hour angle in degrees
        double HA = MST - ra;

        if (HA < 0)
        {
            HA = HA + 360;
        }

        //Convert everything to radians
        HA  *= Mathf.Deg2Rad;
        dec *= Mathf.Deg2Rad;

        //Compute Altitude and Azimuth (RAD)
        double altitude = Math.Asin(Math.Sin(dec) * Math.Sin(_latitude) + Math.Cos(dec) * Math.Cos(_latitude) * Math.Cos(HA));
        double azimuth  = Math.Acos((Math.Sin(dec) - Math.Sin(altitude) * Math.Sin(_latitude)) / (Math.Cos(altitude) * Math.Cos(_latitude)));

        //Convert both to degree
        altitude *= Mathf.Rad2Deg;
        azimuth  *= Mathf.Rad2Deg;

        if (Math.Sin(HA) > 0f)
        {
            azimuth = 360f - azimuth;
        }

        coordinates.x = (float)altitude;
        coordinates.y = (float)azimuth;
        coordinates.z = (float)distance;

        return(coordinates);
    }
Esempio n. 26
0
 public void AddToSolarSystem(PlanetName planet)
 {
     Debug.Log("Add a planet to solar system");
     RenderedPlanets[planet] = true;
 }
Esempio n. 27
0
 public static Sprite GetOutlineSprite(PlanetName planet)
 {
     return(Resources.Load <Sprite>("Images/Planets/Outline" + planet.ToString()));
 }
Esempio n. 28
0
 //CTOR
 public PlanetLongitude(PlanetName planetName, Angle planetLongitude)
 {
     _planetName      = planetName;
     _planetLongitude = planetLongitude;
 }
Esempio n. 29
0
 public void PlanetTracked(PlanetName planet)
 {
     OnPlanetTracked?.Invoke(planet);
 }
Esempio n. 30
0
 /// <summary>
 /// Gets planet by given name.
 /// </summary>
 /// <returns>
 /// The instance of the planet.
 /// </returns>
 /// <param name="planetName">Solar System planet name.</param>
 static Planet getPlanet(PlanetName planetName)
 {
     return(planets.SingleOrDefault(item => item.Name == planetName));
 }