Inheritance: MonoBehaviour
Esempio n. 1
0
 public void TestRoverEncountersObstacleOnOtherSideOfXAxis()
 {
     var planetWithObstacles = new Planet(50, new[] { new Point { X = 0, Y = -25 } });
     var rover = new Rover(new Point(0, 25), 'N', planetWithObstacles);
     var driver = new RoverDriver(rover);
     Assert.That(driver.MoveRover("ffrff"), Is.EqualTo("Rover encountered obstacle at position (0,-25), rover stopped at (0,25)."));
 }
        public void BeEqualForObjectsWithSameValues()
        {
            var p1 = new Planet(
                name: "Mercury",
                massKg: 328500000000000000000000M,
                equatorialDiameterKm: 4879,
                polarDiameterKm: 4879,
                equatorialCircumferenceKm: 15329,
                orbitalDistanceKm: 57909227,
                orbitPeriodEarthDays: 87.97M,
                minSurfaceTemperatureCelsius: -173,
                maxSurfaceTemperatureCelsius: 427);

            var p2 = new Planet(
                name: "Mercury",
                massKg: 328500000000000000000000M,
                equatorialDiameterKm: 4879,
                polarDiameterKm: 4879,
                equatorialCircumferenceKm: 15329,
                orbitalDistanceKm: 57909227,
                orbitPeriodEarthDays: 87.97M,
                minSurfaceTemperatureCelsius: -173,
                maxSurfaceTemperatureCelsius: 427);

            Assert.IsTrue(p1.Equals(p2));
            Assert.IsTrue(p2.Equals(p1));
        }
Esempio n. 3
0
 public void TestRoverEncountersObstacle()
 {
     var planetWithObstacles = new Planet(50, new [] { new Point { X = 3, Y = 3} } );
     var rover = new Rover(new Point(3, 2), 'N', planetWithObstacles);
     var driver = new RoverDriver(rover);
     Assert.That(driver.MoveRover("ffrff"), Is.EqualTo("Rover encountered obstacle at position (3,3), rover stopped at (3,2)."));
 }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        Material earthMaterial = Resources.Load("Materials/Earth/Earth") as Material;
        Material sunMaterial = Resources.Load("Materials/Sun") as Material;
        Material moonMaterial = Resources.Load("Materials/Moon/Moon") as Material;

        Star sun = new Star("Sun", new Vector3(0,0,0), 10, sunMaterial);
        IList planets = new ArrayList();

        for(int i = 0; i < 10; i++) {
            // TODO Change x/z random to randomize within a radius of sun instead of square
            int x = Random.Range(-200, 200);
            int y = 0;
            int z = Random.Range(-200, 200);
            float r = Random.Range(1, 4);
            float spinSpeed = Random.Range(-20, 21);

            Planet p = new Planet("Planet" + i, new Vector3(x, y, z), r, earthMaterial, spinSpeed, sun);
            planets.Add(p);

            int nSatellites = Random.Range(0, 4);
            for(int j = 0; j < nSatellites; j++) {
                float d = Random.Range(2*r, 8*r);
                Vector3 satellitePosition = new Vector3(x+d, y, z);
                float satelliteRadius = (float)Random.Range(r, r*5) / 10;
                float satelliteSpinSpeed = Random.Range(-20, 21);
                p.addSatellite("Satellite"+j+p.name,satellitePosition, satelliteRadius, moonMaterial, satelliteSpinSpeed);
            }
        }

        startUI();
    }
        public void BeUnEqualForObjectsWithDifferentValues()
        {
            var p1 = new Planet(
                name: "Mercury",
                massKg: 328500000000000000000000M,
                equatorialDiameterKm: 4879,
                polarDiameterKm: 4879,
                equatorialCircumferenceKm: 15329,
                orbitalDistanceKm: 57909227,
                orbitPeriodEarthDays: 87.97M,
                minSurfaceTemperatureCelsius: -173,
                maxSurfaceTemperatureCelsius: 427);

            var p2 = new Planet(
                name: "Venus",
                massKg: 4867000000000000000000000M,
                equatorialDiameterKm: 12104,
                polarDiameterKm: 12104,
                equatorialCircumferenceKm: 38025,
                orbitalDistanceKm: 108209475,
                orbitPeriodEarthDays: 224.70M,
                minSurfaceTemperatureCelsius: 462,
                maxSurfaceTemperatureCelsius: 462);

            Assert.IsFalse(p1.Equals(p2));
            Assert.IsFalse(p2.Equals(p1));
        }
Esempio n. 6
0
 public Location(double inputLatitude, double inputLongitude, Planet inputPlanet)
     : this()
 {
     this.Latitude = inputLatitude;
     this.Longitude = inputLongitude;
     this.Planet = inputPlanet;
 }
Esempio n. 7
0
    // Use this for initialization
    protected virtual void Start()
    {
        if(transform.parent != null)
        {
            planet = transform.parent.GetComponent<Planet>();
            if(planet != null)
            {
                //if(!CheckRequirements(planet))
                //	Destroy(gameObject);
            }
        }

        //maintain global scale
        if(transform.parent != null)
        {
            Vector3 correctedScale = new Vector3(transform.localScale.x / transform.parent.localScale.x,
                                                 transform.localScale.y / transform.parent.localScale.y,
                                                 transform.localScale.z / transform.parent.localScale.z);
            transform.localScale = correctedScale;
        }

        //Initialize
        input = new  LocalResource[0];
        output = new LocalResource();
        output.type = LocalResourceType.Power;
        output.quantity = 5;

        outputRange = DEFAULT_OUTPUT_RANGE;
    }
Esempio n. 8
0
 public void DeployToPlanet()
 {
     var planet = new Planet();
     planet.SetSize(100, 50);
     iRover.DeployTo(planet, 0, 0, Movement.CardinalHeading.North);
     Assert.IsNotNull(iRover.DeployedTo);
 }
Esempio n. 9
0
 public Location(double x, double y,Planet planet):this()
 {
     this.latitude = x;
     this.longitude = y;
     this.planets = planet;
     
 }
Esempio n. 10
0
    internal List<Planet> MuteerMijnPlaneet(Planet myPlanet, int strength)
    {
        int index = MijnPlaneten.FindIndex(c => c.PlanetId() == myPlanet.PlanetId());

        MijnPlaneten[index].Sterkte -= strength;
        return MijnPlaneten;
    }
Esempio n. 11
0
    internal List<Planet> MuteerDoelPlaneten(Planet target)
    {
        int index = NietMijnPlaneten.FindIndex(c => c.PlanetId() == target.PlanetId());
        NietMijnPlaneten[index].Owner(1);

        return NietMijnPlaneten;
    }
Esempio n. 12
0
 public Location(double latitude, double longitude, Planet planet)
     : this() // http://stackoverflow.com/questions/788958/why-do-i-have-to-assign-all-fields-inside-an-structs-constructor
 {
     this.Latitude = latitude;
     this.Longitude = longitude;
     this.Planet = planet;
 }
Esempio n. 13
0
 private void MoveToPlanet(Planet planet)
 {
     if (selectedFleet != null)
     {
         selectedFleet.MoveToPlanet(planet);
     }
 }
Esempio n. 14
0
 /// <summary>Traduz um Planeta para texto localizado</summary>
 public string translate( Planet planet )
 {
     return string.Format("<a href='{0}' class='note'>{1}</a>",
             OrionGlobals.getSectionBaseUrl("planet") + "?id="+planet.Id,
             planet.Name
         );
 }
Esempio n. 15
0
    /// <summary>
    /// Draw lines and colors related to dependency.
    /// </summary>
    public void DrawDependencyInfo(Planet planet, Structure structure)
    {
        this.planet = planet;
        this.structure = structure;

        List<Structure> neighbors = planet.GetNeigboringStructures(transform.position);
        this.neighbors = neighbors;

        bool isValid = false;
        ClearDependencyLines();

        foreach(Structure neighbor in neighbors)
        {
            if(structure.CheckRequirements(neighbor.GetOutput()))
            {
                UpdateDependencyLine(neighbor.gameObject);
                isValid = true;
            }
            else
                ClearDependencyLine(neighbor.gameObject);
        }

        if(isValid)
            renderer.material.color = Color.green;
        else
        {
            renderer.material.color = Color.red;
        }
    }
Esempio n. 16
0
 public Missile(Planet planet, Missile_Launcher parent)
     : base(planet, parent, BITMAP.FromFile(@"Picture\Sky\Weapon\Missile.png"), 5, 1.0)
 {
     SPEED.X = parent.BULLET_SPEED;
     SPEED.Y = parent.ANGLE;
     TURN_PERIOD = parent.MISSILE_TURN_PERIOD;
 }
Esempio n. 17
0
 public Location(double latitude, double longitude, Planet planet)
     : this()
 {
     this.Latitude = latitude;
     this.Longitude = longitude;
     this._planet = planet;
 }
Esempio n. 18
0
 public Location(double latitude, double longitude, Planet p)
     : this()
 {
     this.Latitude = latitude;
     this.Longitude = longitude;
     this.CurrentPlanet = p;
 }
Esempio n. 19
0
 public Location(double lat, double longt, Planet planet)
     : this()
 {
     this.Latitude = lat;
     this.Longtitude = longt;
     this.Planet = planet;
 }
 public Location(double latitude, double longitude, Planet planetName)
     : this()
 {
     this.Latitude = latitude;
     this.Longitude = longitude;
     this.PlanetName = planetName;
 }
 public Polyhedra(Planet p, List<Node> n, List<Edge> e, List<Face> f)
 {
     this.planet = p;
     this.nodes = n;
     this.edges = e;
     this.faces = f;
 }
Esempio n. 22
0
	public List<Structure> GetStructureList(Planet.PlanetType Type)
	{
		bool bIsAllowed;
		List<Structure> AvailableStructures = new List<Structure> ();

		for (int i = 0; i < Structures.Count; i++)
		{
			bIsAllowed = true;

			for (int j = 0; j < Structures[i].RestrictedEnvironments.Count; j++)
			{
				if (Type == Structures[i].RestrictedEnvironments[j])
				{
					bIsAllowed = false;
				}
			}

			if (bIsAllowed)
			{
				AvailableStructures.Add(new Structure(Structures[i]));
			}
		}

		return AvailableStructures;
	}
Esempio n. 23
0
        public void GridIsCreated()
        {
            var planet = new Planet(3, 3);

            Assert.That(planet.NumberOfRows, Is.EqualTo(3));
            Assert.That(planet.NumberOfColumns, Is.EqualTo(3));
        }
 public NewTroopMovementEvent(object sender, Planet startPlanet, Planet targetPlanet, int shipCount)
 {
     Sender = sender;
     StartPlanet = startPlanet;
     TargetPlanet = targetPlanet;
     ShipCount = shipCount;
 }
Esempio n. 25
0
 public void AssignPlanet(Planet planet, int orbit)
 {
     if (orbit <= level + 3)
     {
         planets[orbit] = planet;
     }
 }
Esempio n. 26
0
    public void Link(Planet planet)
    {
        this.planet = planet;

        planet.hexPlanet = GetComponent<HexPlanet>();
        planet.behavior = this;
    }
Esempio n. 27
0
  public void GeneratePlanets()
  {
    // Start by generating distance of each planet from sun
    float[] distances = new float[m_numPlanets];
    for (int i = 0; i < m_numPlanets; ++i)
    {
      float rand = Random.value;

      if (rand < 0.2f)
      {
        distances[i] = Random.Range(0.1f, 0.75f);
      }
      else if (rand < 0.3f)
      {
        distances[i] = Random.Range(0.75f, 1.25f);
      }
      else if (rand < 0.9f)
      {
        distances[i] = Random.Range(4f, 25f);
      }
      else
      {
        distances[i] = Random.Range(35.0f, 50.0f);
      }
    }

    System.Array.Sort(distances);

    for (int i = 0; i < m_numPlanets; ++i)
    {
      m_planets[i] = new Planet(distances[i], starType);
    }
  }
Esempio n. 28
0
    public bool createSystem()
    {
        bool system_created = false;

        if(num_planets > 0 ){
          //create the system!
          base.sub_spheres = new SphereRenderer[num_planets];

          /*create the sun!*/
          int ptype = 101;
          float pmass = 1000000f;
          string pname = name + " - Sun";
          float pradius = 12f;
          float pdistance = 0f;
          Vector3 pposition = new Vector3(position.x, Random.Range(-400, 400), position.z);
          Debug.Log(pposition);
          Planet planet = new Planet(ptype, pmass, pname, pradius, pdistance, pposition);
          planet.createPlanet();

          factory = (SphereRendererFactory)GameObject.Find("SphereRendererFactory").GetComponent("SphereRendererFactory");
          base.sub_spheres[0] = factory.createSphereRenderer();
          base.sub_spheres[0].initialize(0, 0, planet_threshold,1 , planet);
          base.sub_spheres[0].setIsDisplayed(true);
          /* end create sun */
          pdistance += 15f;
          /*create planets*/
          for(int i = 1; i < (num_planets); i++){
        float omega = Random.Range(0, 2*Mathf.PI);
        /* sphere types
        * 0 - Dead
        * 1 - Fuel Source
        * 2 - Habitable
        * 3 - Sun
        * 4 - Planetary System
        * 5 - System Cluster
        */
        ptype = Random.Range(0, 100);
        pmass = Random.Range(1000f, 10000f);
        pname = name + " - " + i;
        pradius = Random.Range(10f, 20f);
        pdistance = Random.Range(pdistance, pdistance + 100f);
        pposition = new Vector3(position.x + pdistance*Mathf.Cos(omega) , Random.Range(-100, 100), position.z + pdistance*Mathf.Sin(omega));
        planet = new Planet(ptype, pmass, pname, pradius, pdistance, pposition);
        planet_threshold = pradius + 10f;

        if(!planet.createPlanet()){
          system_created = false;
          break;
        }
        else{
          factory = (SphereRendererFactory)GameObject.Find("SphereRendererFactory").GetComponent("SphereRendererFactory");
          base.sub_spheres[i] = factory.createSphereRenderer();
          base.sub_spheres[i].initialize(0, 0, planet_threshold,1 , planet);
          base.sub_spheres[i].setIsDisplayed(true);
        }
        system_created = true;
          }
        }
        return system_created;
    }
Esempio n. 29
0
 public Location(double latitude, double longitude, Planet planet)
     : this()
 {
     Latitude = latitude;
     Longitude = longitude;
     Planet = planet;
 }
Esempio n. 30
0
 // Use this for initialization
 void Awake()
 {
     dependencyLines = new Dictionary<GameObject, VectorLine>();
     planet = null;
     structure = null;
     neighbors = new List<Structure>();
 }
Esempio n. 31
0
 private void OnEnable()
 {
     planet = (Planet)target;
 }
Esempio n. 32
0
 public void SetTarget(Planet p)
 {
     target = p;
 }
 public PlanetArmada(Planet owner)
 {
     PlanetUnderAttack = owner;
 }
Esempio n. 34
0
        override public List <GameObject> SetValueOfGameObjects()
        {
            List <GameObject> gameObjects = new List <GameObject>();

            countOfMeteors = 350;


            centerPlanet = new Planet();
            gameObjects.Add(centerPlanet);
            centerPlanet.phisObj.angulVel = -2 * Math.PI / 500;

            centerPlanet.image = MainWindow.window.CenterStar;



            planets = new List <Planet>();
            for (int i = 0; i < countOfPlanets; i++)
            {
                planets.Add(new Planet());
                gameObjects.Add(planets[i]);

                planets[i].image = MainWindow.Clone(MainWindow.window.SmallPlanet);
                MainWindow.window.PlayingCanvas.Children.Add(planets[i].image);

                planets[i].phisObj.mass  = centerPlanet.phisObj.mass / 100;
                planets[i].phisObj.coord = centerPlanet.phisObj.coord + Coord.FromPolar(500 + 400, 2 * Math.PI / countOfPlanets * i);
                planets[i].phisObj.speed = Gravitation.CosmicSpeeds(planets[i].phisObj, centerPlanet.phisObj, 1);
            }



            rocket = new Rocket();
            gameObjects.Add(rocket);

            rocket.image = MainWindow.window.Rocket;

            rocket.Y     = -400;
            rocket.Angle = 0;

            rocket.phisObj.speed = Gravitation.CosmicSpeeds(rocket.phisObj, centerPlanet.phisObj, 1);


            fire = new ReactiveGases(rocket);

            fire.image = MainWindow.window.Fire;

            gameObjects.Add(fire);


            playingBorder = new PlayingBorder(centerPlanet, rocket);

            playingBorder.image = MainWindow.window.Border;

            gameObjects.Add(playingBorder);



            meteors = SetValueOfMeteors();

            gameObjects = gameObjects.Concat(meteors).ToList();



            return(gameObjects);
        }
Esempio n. 35
0
    private void GetNearestPlanetOrShip(Collider2D[] colliders, out Ship nearestShip, out Planet nearestPlanet)
    {
        nearestShip   = null;
        nearestPlanet = null;
        float nearestSqrDistance = float.MaxValue;

        foreach (Collider2D collider in colliders)
        {
            Vector3 toTarget = collider.gameObject.transform.position - transform.position;
            if (toTarget.sqrMagnitude < nearestSqrDistance)
            {
                Ship ship = collider.gameObject.GetComponent <Ship>();
                if (ship != null)
                {
                    nearestShip        = ship;
                    nearestPlanet      = null;
                    nearestSqrDistance = toTarget.sqrMagnitude;
                }
                Planet planet = collider.gameObject.GetComponent <Planet>();
                if (planet != null)
                {
                    nearestShip        = null;
                    nearestPlanet      = planet;
                    nearestSqrDistance = toTarget.sqrMagnitude;
                }
            }
        }
    }
Esempio n. 36
0
        public async void GetPage_Returns_Multiple_Planets()
        {
            var result = await Planet.GetPage();

            Assert.IsInstanceOf <List <Planet> >(result);
        }
Esempio n. 37
0
 public void RemovePlanet(Planet planet)
 {
     planets.Remove(planet);
 }
Esempio n. 38
0
        private static void CheckForSpecialRules(out double abund, out double react, double pressure, Planet planet, ChemType gas)
        {
            var sun   = planet.Star;
            var pres2 = 1.0;

            abund = gas.abunds;

            if (gas.symbol == "Ar")
            {
                react = .15 * sun.AgeYears / 4e9;
            }
            else if (gas.symbol == "He")
            {
                abund = abund * (0.001 + (planet.GasMassSM / planet.MassSM));
                pres2 = (0.75 + pressure);
                react = Math.Pow(1 / (1 + gas.reactivity), sun.AgeYears / 2e9 * pres2);
            }
            else if ((gas.symbol == "O" || gas.symbol == "O2") && sun.AgeYears > 2e9 && planet.SurfaceTempKelvin > 270 && planet.SurfaceTempKelvin < 400)
            {
                // pres2 = (0.65 + pressure/2); // Breathable - M: .55-1.4
                pres2 = (0.89 + pressure / 4);  // Breathable - M: .6 -1.8
                react = Math.Pow(1 / (1 + gas.reactivity), Math.Pow(sun.AgeYears / 2e9, 0.25) * pres2);
            }
            else if (gas.symbol == "CO2" && sun.AgeYears > 2e9 && planet.SurfaceTempKelvin > 270 && planet.SurfaceTempKelvin < 400)
            {
                pres2  = (0.75 + pressure);
                react  = Math.Pow(1 / (1 + gas.reactivity), Math.Pow(sun.AgeYears / 2e9, 0.5) * pres2);
                react *= 1.5;
            }
            else
            {
                pres2 = (0.75 + pressure);
                react = Math.Pow(1 / (1 + gas.reactivity), sun.AgeYears / 2e9 * pres2);
            }
        }
Esempio n. 39
0
    public IEnumerator ExplodePlanet(Planet planet, float delay)
    {
        yield return(new WaitForSeconds(delay));

        planet.Explode();
    }
Esempio n. 40
0
 public static bool GoalCheck(Planet goal, Node currentNode)
 {
     return(goal.Equals(currentNode.planet));
 }
Esempio n. 41
0
 public void OnMouseExitPlanet(Planet _p)
 {
     m_hoveredPlanet = null;
 }
Esempio n. 42
0
 public void OnMouseEnterPlanet(Planet _p)
 {
     m_hoveredPlanet = _p;
 }
Esempio n. 43
0
    // Use this for initialization
    void Start()
    {
        GameManager   gm      = FindObjectOfType <GameManager>();
        List <Planet> planets = new List <Planet>();

        string vowels     = "aeiou";
        string consonants = "bcdfghjklmnpqrstvwxz";

        //planetPrefabs instantiations
        for (int i = 0; i < nbPlanet; i++)
        {
            //position entre -2 et 2 et -4 et 4 par pas de 0.5
            float x = 0.5f * Random.Range(0, 9) - 2;
            float y = 0.5f * Random.Range(0, 17) - 4;

            // Name generation
            int    nameLength = Random.Range(1, 6) * 2;
            string planetName = "";
            //int vowelConsonantSelector = Random.Range(0, 2); // outer bound is exclusive, so 2 and not 1
            int vowelConsonantSelector = 1; // 0 is vowel, 1 is consonant
            for (int l = 0; l < nameLength; ++l)
            {
                char nextChar;
                if (vowelConsonantSelector == 0)
                {
                    nextChar = vowels[Random.Range(0, vowels.Length)];
                }
                else
                {
                    nextChar = consonants[Random.Range(0, consonants.Length)];
                }
                planetName            += nextChar;
                vowelConsonantSelector = (vowelConsonantSelector + 1) % 2;
            }


            // Add planet
            Planet p = Instantiate(planetPrefab, new Vector3(x, y, 0.0f), Quaternion.identity);
            //One chance out of three to be spiced
            int isSpice = Random.Range(0, 4);
            if (isSpice == 0)
            {
                p.isSpiceProvider = true;
            }
            else
            {
                p.isSpiceProvider = false;
            }
            p.name = planetName;
            p.SetMaxLinkCount(Random.Range(2, 4));
            p.armyCount = Random.Range(0, 4);
            planets.Add(p);
        }


        //Links Creation

        /*for (int j = 0; j < nbPlanet; j++) {
         *  for (int i = 0; i < nbPlanet; i++)
         *  {
         *      if (i != j) {
         *          CreateLink(planets[j], planets[i]);
         *      }
         *  }
         * }*/

        //Assign Players
        for (int i = 0; i < gm.GetPlayers().Count; ++i)
        {
            if (i >= nbPlanet)
            {
                break;
            }

            planets[i].owner     = gm.GetPlayers()[i];
            planets[i].armyCount = 3;
        }
    }
Esempio n. 44
0
        private static Planet GeneratePlanet(PlanetSeed seed, int planetNo, ref Star sun, bool useRandomTilt, string planetID, bool isMoon, SystemGenerationOptions genOptions)
        {
            var planet = new Planet(seed, sun, planetNo);

            planet.OrbitZone         = Environment.OrbitalZone(sun.Luminosity, planet.SemiMajorAxisAU);
            planet.OrbitalPeriodDays = Environment.Period(planet.SemiMajorAxisAU, planet.MassSM, sun.Mass);
            if (useRandomTilt)
            {
                planet.AxialTiltDegrees = Environment.Inclination(planet.SemiMajorAxisAU);
            }
            planet.ExosphereTempKelvin = GlobalConstants.EARTH_EXOSPHERE_TEMP / Utilities.Pow2(planet.SemiMajorAxisAU / sun.EcosphereRadiusAU);
            planet.RMSVelocityCMSec    = Environment.RMSVelocity(GlobalConstants.MOL_NITROGEN, planet.ExosphereTempKelvin);
            planet.CoreRadiusKM        = Environment.KothariRadius(planet.DustMassSM, false, planet.OrbitZone);

            // Calculate the radius as a gas giant, to verify it will retain gas.
            // Then if mass > Earth, it's at least 5% gas and retains He, it's
            // some flavor of gas giant.

            planet.DensityGCC = Environment.EmpiricalDensity(planet.MassSM, planet.SemiMajorAxisAU, sun.EcosphereRadiusAU, true);
            planet.RadiusKM   = Environment.VolumeRadius(planet.MassSM, planet.DensityGCC);

            planet.SurfaceAccelerationCMSec2 = Environment.Acceleration(planet.MassSM, planet.RadiusKM);
            planet.SurfaceGravityG           = Environment.Gravity(planet.SurfaceAccelerationCMSec2);

            planet.MolecularWeightRetained = Environment.MinMolecularWeight(planet);

            // Is the planet a gas giant?
            if (((planet.MassSM * GlobalConstants.SUN_MASS_IN_EARTH_MASSES) > 1.0) && ((planet.GasMassSM / planet.MassSM) > 0.05) && (planet.MolecularWeightRetained <= 4.0))
            {
                if ((planet.GasMassSM / planet.MassSM) < 0.20)
                {
                    planet.Type = PlanetType.SubSubGasGiant;
                }
                else if ((planet.MassSM * GlobalConstants.SUN_MASS_IN_EARTH_MASSES) < 20.0)
                {
                    planet.Type = PlanetType.SubGasGiant;
                }
                else
                {
                    planet.Type = PlanetType.GasGiant;
                }
            }
            else // If not, it's rocky.
            {
                planet.RadiusKM   = Environment.KothariRadius(planet.MassSM, false, planet.OrbitZone);
                planet.DensityGCC = Environment.VolumeDensity(planet.MassSM, planet.RadiusKM);

                planet.SurfaceAccelerationCMSec2 = Environment.Acceleration(planet.MassSM, planet.RadiusKM);
                planet.SurfaceGravityG           = Environment.Gravity(planet.SurfaceAccelerationCMSec2);

                if ((planet.GasMassSM / planet.MassSM) > 0.000001)
                {
                    var h2Mass = planet.GasMassSM * 0.85;
                    var heMass = (planet.GasMassSM - h2Mass) * 0.999;

                    var h2Life = Environment.GasLife(GlobalConstants.MOL_HYDROGEN, planet.ExosphereTempKelvin,
                                                     planet.SurfaceGravityG, planet.RadiusKM);
                    var heLife = Environment.GasLife(GlobalConstants.HELIUM, planet.ExosphereTempKelvin,
                                                     planet.SurfaceGravityG, planet.RadiusKM);

                    if (h2Life < sun.AgeYears)
                    {
                        var h2Loss = ((1.0 - (1.0 / Math.Exp(sun.AgeYears / h2Life))) * h2Mass);

                        planet.GasMassSM -= h2Loss;
                        planet.MassSM    -= h2Loss;

                        planet.SurfaceAccelerationCMSec2 = Environment.Acceleration(planet.MassSM, planet.RadiusKM);
                        planet.SurfaceGravityG           = Environment.Gravity(planet.SurfaceAccelerationCMSec2);
                    }

                    if (heLife < sun.AgeYears)
                    {
                        var heLoss = ((1.0 - (1.0 / Math.Exp(sun.AgeYears / heLife))) * heMass);

                        planet.GasMassSM -= heLoss;
                        planet.MassSM    -= heLoss;

                        planet.SurfaceAccelerationCMSec2 = Environment.Acceleration(planet.MassSM, planet.RadiusKM);
                        planet.SurfaceGravityG           = Environment.Gravity(planet.SurfaceAccelerationCMSec2);
                    }
                }
            }

            planet.AngularVelocityRadSec = Environment.AngularVelocity(planet);
            planet.DayLengthHours        = Environment.DayLength(planet.AngularVelocityRadSec, planet.OrbitalPeriodDays,
                                                                 planet.Eccentricity);
            planet.HasResonantPeriod = Environment.HasResonantPeriod(planet.AngularVelocityRadSec,
                                                                     planet.DayLengthHours, planet.OrbitalPeriodDays, planet.Eccentricity);
            planet.EscapeVelocityCMSec = Environment.EscapeVelocity(planet.MassSM, planet.RadiusKM);
            planet.HillSphereKM        = Environment.SimplifiedHillSphereKM(sun.Mass, planet.MassSM, planet.SemiMajorAxisAU);

            if (planet.IsGasGiant)
            {
                planet.HasGreenhouseEffect        = false;
                planet.VolatileGasInventory       = GlobalConstants.INCREDIBLY_LARGE_NUMBER;
                planet.Atmosphere.SurfacePressure = GlobalConstants.INCREDIBLY_LARGE_NUMBER;

                planet.BoilingPointWaterKelvin = GlobalConstants.INCREDIBLY_LARGE_NUMBER;

                planet.SurfaceTempKelvin    = GlobalConstants.INCREDIBLY_LARGE_NUMBER;
                planet.GreenhouseRiseKelvin = 0;
                planet.Albedo                  = Utilities.About(GlobalConstants.GAS_GIANT_ALBEDO, 0.1);
                planet.WaterCoverFraction      = 1.0;
                planet.CloudCoverFraction      = 1.0;
                planet.IceCoverFraction        = 0.0;
                planet.SurfaceGravityG         = Environment.Gravity(planet.SurfaceAccelerationCMSec2);
                planet.MolecularWeightRetained = Environment.MinMolecularWeight(planet);
                planet.SurfaceGravityG         = GlobalConstants.INCREDIBLY_LARGE_NUMBER;
            }
            else
            {
                planet.SurfaceGravityG         = Environment.Gravity(planet.SurfaceAccelerationCMSec2);
                planet.MolecularWeightRetained = Environment.MinMolecularWeight(planet);

                planet.HasGreenhouseEffect  = Environment.Greenhouse(sun.EcosphereRadiusAU, planet.SemiMajorAxisAU);
                planet.VolatileGasInventory = Environment.VolatileInventory(
                    planet.MassSM, planet.EscapeVelocityCMSec, planet.RMSVelocityCMSec, sun.Mass,
                    planet.OrbitZone, planet.HasGreenhouseEffect, (planet.GasMassSM / planet.MassSM) > 0.000001);
                planet.Atmosphere.SurfacePressure = Environment.Pressure(
                    planet.VolatileGasInventory, planet.RadiusKM, planet.SurfaceGravityG);

                planet.BoilingPointWaterKelvin = Math.Abs(planet.Atmosphere.SurfacePressure) < 0.001
                    ? 0.0
                    : Environment.BoilingPoint(planet.Atmosphere.SurfacePressure);

                // Sets: planet.surf_temp, planet.greenhs_rise, planet.albedo, planet.hydrosphere,
                // planet.cloud_cover, planet.ice_cover
                Environment.IterateSurfaceTemp(ref planet);

                CalculateGases(planet, genOptions.GasTable);

                planet.IsTidallyLocked = Environment.IsTidallyLocked(planet);

                // Assign planet type
                if (planet.Atmosphere.SurfacePressure < 1.0)
                {
                    if (!isMoon && ((planet.MassSM * GlobalConstants.SUN_MASS_IN_EARTH_MASSES) < GlobalConstants.ASTEROID_MASS_LIMIT))
                    {
                        planet.Type = PlanetType.Asteroids;
                    }
                    else
                    {
                        planet.Type = PlanetType.Barren;
                    }
                }
                else if ((planet.Atmosphere.SurfacePressure > 6000.0) && (planet.MolecularWeightRetained <= 2.0)) // Retains Hydrogen
                {
                    planet.Type = PlanetType.SubSubGasGiant;
                    planet.Atmosphere.Composition = new List <Gas>();
                }
                else
                {
                    // Atmospheres:
                    // TODO remove PlanetType enum entirely and replace it with a more flexible classification systme
                    if (planet.WaterCoverFraction >= 0.95) // >95% water
                    {
                        planet.Type = PlanetType.Water;
                    }
                    else if (planet.IceCoverFraction >= 0.95) // >95% ice
                    {
                        planet.Type = PlanetType.Ice;
                    }
                    else if (planet.WaterCoverFraction > 0.05) // Terrestrial
                    {
                        planet.Type = PlanetType.Terrestrial;
                    }
                    else if (planet.MaxTempKelvin > planet.BoilingPointWaterKelvin) // Hot = Venusian
                    {
                        planet.Type = PlanetType.Venusian;
                    }
                    else if ((planet.GasMassSM / planet.MassSM) > 0.0001) // Accreted gas, but no greenhouse or liquid water make it an ice world
                    {
                        planet.Type             = PlanetType.Ice;
                        planet.IceCoverFraction = 1.0;
                    }
                    else if (planet.Atmosphere.SurfacePressure <= 250.0) // Thin air = Martian
                    {
                        planet.Type = PlanetType.Martian;
                    }
                    else if (planet.SurfaceTempKelvin < GlobalConstants.FREEZING_POINT_OF_WATER)
                    {
                        planet.Type = PlanetType.Ice;
                    }
                    else
                    {
                        planet.Type = PlanetType.Unknown;
                    }
                }
            }

            // Generate moons
            planet.Moons = new List <Planet>();
            if (!isMoon)
            {
                var curMoon = seed.FirstMoon;
                var n       = 0;
                while (curMoon != null)
                {
                    if (curMoon.Mass * GlobalConstants.SUN_MASS_IN_EARTH_MASSES > .000001)
                    {
                        curMoon.SemiMajorAxisAU = planet.SemiMajorAxisAU;
                        curMoon.Eccentricity    = planet.Eccentricity;

                        n++;

                        string moon_id = String.Format("{0}.{1}", planetID, n);

                        var generatedMoon = GeneratePlanet(curMoon, n, ref sun, useRandomTilt, moon_id, true, genOptions);

                        double roche_limit = 2.44 * planet.RadiusKM * Math.Pow((planet.DensityGCC / generatedMoon.DensityGCC), (1.0 / 3.0));
                        double hill_sphere = planet.SemiMajorAxisAU * GlobalConstants.KM_PER_AU * Math.Pow((planet.MassSM / (3.0 * sun.Mass)), (1.0 / 3.0));

                        if ((roche_limit * 3.0) < hill_sphere)
                        {
                            generatedMoon.MoonSemiMajorAxisAU = Utilities.RandomNumber(roche_limit * 1.5, hill_sphere / 2.0) / GlobalConstants.KM_PER_AU;
                            generatedMoon.MoonEccentricity    = Utilities.RandomEccentricity();
                        }
                        else
                        {
                            generatedMoon.MoonSemiMajorAxisAU = 0;
                            generatedMoon.MoonEccentricity    = 0;
                        }
                        planet.Moons.Add(generatedMoon);
                    }
                    curMoon = curMoon.NextPlanet;
                }
            }

            return(planet);
        }
Esempio n. 45
0
 public double AgeHelper(Planet planet)
 {
     return(Math.Round(Seconds / yearLenDict[planet], 2));
 }
Esempio n. 46
0
        // TODO this really should be in a separate class
        public static void CalculateGases(Planet planet, ChemType[] gasTable)
        {
            var sun = planet.Star;

            planet.Atmosphere.Composition = new List <Gas>();

            if (!(planet.Atmosphere.SurfacePressure > 0))
            {
                return;
            }

            double[] amount    = new double[gasTable.Length];
            double   totamount = 0;
            double   pressure  = planet.Atmosphere.SurfacePressure / GlobalConstants.MILLIBARS_PER_BAR;
            int      n         = 0;

            // Determine the relative abundance of each gas in the planet's atmosphere
            for (var i = 0; i < gasTable.Length; i++)
            {
                double yp = gasTable[i].boil / (373.0 * ((Math.Log((pressure) + 0.001) / -5050.5) + (1.0 / 373.0)));

                // TODO move both of these conditions to separate methods
                if ((yp >= 0 && yp < planet.NighttimeTempKelvin) && (gasTable[i].weight >= planet.MolecularWeightRetained))
                {
                    double abund, react;
                    CheckForSpecialRules(out abund, out react, pressure, planet, gasTable[i]);

                    double vrms  = Environment.RMSVelocity(gasTable[i].weight, planet.ExosphereTempKelvin);
                    double pvrms = Math.Pow(1 / (1 + vrms / planet.EscapeVelocityCMSec), sun.AgeYears / 1e9);

                    double fract = (1 - (planet.MolecularWeightRetained / gasTable[i].weight));

                    // Note that the amount calculated here is unitless and doesn't really mean
                    // anything except as a relative value
                    amount[i]  = abund * pvrms * react * fract;
                    totamount += amount[i];
                    if (amount[i] > 0.0)
                    {
                        n++;
                    }
                }
                else
                {
                    amount[i] = 0.0;
                }
            }

            // For each gas present, calculate its partial pressure
            if (n > 0)
            {
                planet.Atmosphere.Composition = new List <Gas>();

                n = 0;
                for (var i = 0; i < gasTable.Length; i++)
                {
                    if (amount[i] > 0.0)
                    {
                        planet.Atmosphere.Composition.Add(
                            new Gas(gasTable[i], planet.Atmosphere.SurfacePressure * amount[i] / totamount));
                    }
                }
            }
        }
Esempio n. 47
0
 // Start is called before the first frame update
 void Start()
 {
     planet = FindObjectOfType <Planet>();
     resolutionSlider.value = planet.resolution;
 }
    public static void FillMesh(ref Mesh meshToUpdate, int chunkX, int chunkY, int chunkZ, Planet world, int size, int height, float surfaceCrossValue)
    {
        int vertexIndex = 0;

        Vector3[] interpolatedValues = new Vector3[12];

        List <Vector3> vertices        = new List <Vector3>();
        List <int>     triangleIndices = new List <int>();

        Debug.Log(size + " " + height);

        for (int x = 0; x < size; x++)
        {
            for (int y = 0; y < height - 1; y++)
            {
                for (int z = 0; z < size; z++)
                {
                    if (vertices.Count > 64000)
                    {
                        Debug.LogError("Mesh should be less complex");
                        break;
                    }

                    Vector3 basePoint = new Vector3(x, y, z);

                    float p0 = world.GetValue(chunkX + x, chunkY + y, chunkZ + z);
                    float p1 = world.GetValue(chunkX + x + 1, chunkY + y, chunkZ + z);
                    float p2 = world.GetValue(chunkX + x, chunkY + y + 1, chunkZ + z);
                    float p3 = world.GetValue(chunkX + x + 1, chunkY + y + 1, chunkZ + z);
                    float p4 = world.GetValue(chunkX + x, chunkY + y, chunkZ + z + 1);
                    float p5 = world.GetValue(chunkX + x + 1, chunkY + y, chunkZ + z + 1);
                    float p6 = world.GetValue(chunkX + x, chunkY + y + 1, chunkZ + z + 1);
                    float p7 = world.GetValue(chunkX + x + 1, chunkY + y + 1, chunkZ + z + 1);

                    int crossBitMap = 0;


                    if (p0 < surfaceCrossValue)
                    {
                        crossBitMap |= 1;
                    }
                    if (p1 < surfaceCrossValue)
                    {
                        crossBitMap |= 2;
                    }

                    if (p2 < surfaceCrossValue)
                    {
                        crossBitMap |= 8;
                    }
                    if (p3 < surfaceCrossValue)
                    {
                        crossBitMap |= 4;
                    }

                    if (p4 < surfaceCrossValue)
                    {
                        crossBitMap |= 16;
                    }
                    if (p5 < surfaceCrossValue)
                    {
                        crossBitMap |= 32;
                    }

                    if (p6 < surfaceCrossValue)
                    {
                        crossBitMap |= 128;
                    }
                    if (p7 < surfaceCrossValue)
                    {
                        crossBitMap |= 64;
                    }

                    int edgeBits = Contouring3D.EdgeTableLookup[crossBitMap];

                    if (edgeBits == 0)
                    {
                        continue;
                    }

                    float interpolatedCrossingPoint = 0f;

                    if ((edgeBits & 1) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p0) / (p1 - p0);
                        interpolatedValues[0]     = Vector3.Lerp(new Vector3(x, y, z), new Vector3(x + 1, y, z), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 2) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p1) / (p3 - p1);
                        interpolatedValues[1]     = Vector3.Lerp(new Vector3(x + 1, y, z), new Vector3(x + 1, y + 1, z), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 4) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p2) / (p3 - p2);
                        interpolatedValues[2]     = Vector3.Lerp(new Vector3(x, y + 1, z), new Vector3(x + 1, y + 1, z), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 8) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p0) / (p2 - p0);
                        interpolatedValues[3]     = Vector3.Lerp(new Vector3(x, y, z), new Vector3(x, y + 1, z), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 16) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p4) / (p5 - p4);
                        interpolatedValues[4]     = Vector3.Lerp(new Vector3(x, y, z + 1), new Vector3(x + 1, y, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 32) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p5) / (p7 - p5);
                        interpolatedValues[5]     = Vector3.Lerp(new Vector3(x + 1, y, z + 1), new Vector3(x + 1, y + 1, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 64) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p6) / (p7 - p6);
                        interpolatedValues[6]     = Vector3.Lerp(new Vector3(x, y + 1, z + 1), new Vector3(x + 1, y + 1, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 128) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p4) / (p6 - p4);
                        interpolatedValues[7]     = Vector3.Lerp(new Vector3(x, y, z + 1), new Vector3(x, y + 1, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 256) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p0) / (p4 - p0);
                        interpolatedValues[8]     = Vector3.Lerp(new Vector3(x, y, z), new Vector3(x, y, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 512) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p1) / (p5 - p1);
                        interpolatedValues[9]     = Vector3.Lerp(new Vector3(x + 1, y, z), new Vector3(x + 1, y, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 1024) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p3) / (p7 - p3);
                        interpolatedValues[10]    = Vector3.Lerp(new Vector3(x + 1, y + 1, z), new Vector3(x + 1, y + 1, z + 1), interpolatedCrossingPoint);
                    }
                    if ((edgeBits & 2048) > 0)
                    {
                        interpolatedCrossingPoint = (surfaceCrossValue - p2) / (p6 - p2);
                        interpolatedValues[11]    = Vector3.Lerp(new Vector3(x, y + 1, z), new Vector3(x, y + 1, z + 1), interpolatedCrossingPoint);
                    }

                    crossBitMap <<= 4;

                    int triangleIndex = 0;
                    Debug.Log(Contouring3D.TriangleLookupTable[crossBitMap + triangleIndex]);
                    while (Contouring3D.TriangleLookupTable[crossBitMap + triangleIndex] != -1)
                    {
                        int index1 = Contouring3D.TriangleLookupTable[crossBitMap + triangleIndex];
                        int index2 = Contouring3D.TriangleLookupTable[crossBitMap + triangleIndex + 1];
                        int index3 = Contouring3D.TriangleLookupTable[crossBitMap + triangleIndex + 2];

                        vertices.Add(new Vector3(interpolatedValues[index1].x, interpolatedValues[index1].y, interpolatedValues[index1].z));
                        vertices.Add(new Vector3(interpolatedValues[index2].x, interpolatedValues[index2].y, interpolatedValues[index2].z));
                        vertices.Add(new Vector3(interpolatedValues[index3].x, interpolatedValues[index3].y, interpolatedValues[index3].z));

                        triangleIndices.Add(vertexIndex);
                        triangleIndices.Add(vertexIndex + 1);
                        triangleIndices.Add(vertexIndex + 2);
                        vertexIndex   += 3;
                        triangleIndex += 3;
                    }
                }
            }
        }

        List <Vector2> texCoords       = new List <Vector2>();
        Vector2        emptyTexCoords0 = new Vector2(0, 0);
        Vector2        emptyTexCoords1 = new Vector2(0, 1);
        Vector2        emptyTexCoords2 = new Vector2(1, 1);

        for (int texturePointer = 0; texturePointer < vertices.Count; texturePointer += 3)
        {
            texCoords.Add(emptyTexCoords1);
            texCoords.Add(emptyTexCoords2);
            texCoords.Add(emptyTexCoords0);
        }

        Debug.Log("----------------");
        foreach (var vert in vertices)
        {
            Debug.Log("x: " + vert.x + " y: " + vert.y + " z: " + vert.z);
        }
        meshToUpdate.Clear();
        meshToUpdate.vertices  = vertices.ToArray();
        meshToUpdate.triangles = triangleIndices.ToArray();
        meshToUpdate.uv        = texCoords.ToArray();
        meshToUpdate.RecalculateNormals();
        meshToUpdate.RecalculateBounds();
    }
Esempio n. 49
0
 private bool CheckCanBeMined(Planet planet)
 {
     return(true);
 }
Esempio n. 50
0
 private void Start()
 {
     cam          = Camera.main;
     planetScript = planet.GetComponent <Planet>();
     camScript    = cam.GetComponent <CameraController>();
 }
Esempio n. 51
0
            public void AddPlanetToList(string planetName, int planetMass)
            {
                Planet newPlanet = new Planet(planetName, planetMass);

                planets.Add(newPlanet);
            }
 public Planet Add(Planet planet)
 {
     Db.Planets.Add(planet);
     Db.SaveChanges();
     return(GetById(planet.Id));
 }
Esempio n. 53
0
 public void updateWaterLevel()
 {
     LevelWater = 1 / (Planet.hauteurPoint(coord) - planet.waterLevel);
 }
Esempio n. 54
0
 void Start()
 {
     homePlanet = transform.parent.GetComponent <Planet>();
 }
Esempio n. 55
0
    public static List <Node> BuildFrontier(Node expandingNode, List <Node> frontier, List <Node> closedList, Planet goal)
    {
        List <Node> newFrontier  = frontier;
        List <Node> expandResult = expandingNode.Expand();

        foreach (Node nNode in expandResult)
        {
            bool invalidNode = false;
            foreach (Node oldNode in newFrontier)
            {
                if (nNode.Equals(oldNode))
                {
                    invalidNode = true;
                }
            }
            foreach (Node closedNode in closedList)
            {
                if (closedNode.Equals(nNode))
                {
                    invalidNode = true;
                }
            }
            if (!invalidNode)
            {
                nNode.heuristic = Vector3.Distance(nNode.planet.transform.position, goal.transform.position);
                frontier.Add(nNode);
            }
        }

        return(newFrontier);
    }
Esempio n. 56
0
    public bool isCoast()
    {
        float hauteur = Planet.hauteurPoint(coord);

        return(0.999 * planet.waterLevel <= hauteur && 1.001 * planet.waterLevel >= hauteur);
    }
Esempio n. 57
0
 public void Build()
 {
     _planet = transform.parent.parent.GetComponent <Planet>();
     OnBuild();
 }
Esempio n. 58
0
        public async void Planet_1_Returns_Planet()
        {
            Planet planet = await Planet.Get(1);

            Assert.IsNotNull(planet);
        }
Esempio n. 59
0
    private void Start()
    {
        SL         = GameObject.Find("SL").GetComponent <SAVELOAD>();
        cameraMove = GetComponent <CameraMove>();
        admob      = GetComponent <ADMOBManager>();

        rCam = GameObject.Find("RatingCamera");
        sCam = GameObject.Find("SpaceCamera");
        pCam = GameObject.Find("PlanetCamera");

        Planet = GameObject.Find("PlanetLevel");
        Space  = GameObject.Find("CanvasSpaces");
        Rating = GameObject.Find("CanvasRatings");
        UI     = GameObject.Find("CanvasUI");

        CanvasSpace  = UI.transform.Find("CanvasSpace").gameObject;
        CanvasRating = UI.transform.Find("CanvasRating").gameObject;
        CanvasPlanet = UI.transform.Find("CanvasPlanet").gameObject;

        objTable = GameObject.Find("Table");
        objBlack = CanvasPlanet.transform.Find("Black").gameObject;
        objHint  = CanvasPlanet.transform.Find("Hint").gameObject;


        Score     = CanvasPlanet.transform.Find("Overlay/Score").GetComponent <Score>();
        statistic = CanvasPlanet.transform.Find("Overlay/Statistic").GetComponent <Statistic>();
        objBonusF = CanvasPlanet.transform.Find("Overlay/BonusF").gameObject;
        objBonusR = CanvasPlanet.transform.Find("Overlay/BonusR").gameObject;
        objBonusC = CanvasPlanet.transform.Find("Overlay/BonusC").gameObject;


        PlanetInfo = Planet.GetComponent <PlanetInfo>();


        Mines     = Planet.transform.Find("Mines").GetComponent <Mines>();
        objEl     = Planet.transform.Find("Up/Elevator").gameObject;
        objFac    = Planet.transform.Find("Up/Factory").gameObject;
        objLab    = Planet.transform.Find("Up/Lab").gameObject;
        objStock  = Planet.transform.Find("Up/Stock").gameObject;
        objBoer   = Planet.transform.Find("Up/Boer").gameObject;
        objRock   = Planet.transform.Find("Up/RocketPlace").gameObject;
        objRJ     = Planet.transform.Find("RobotEnginer").gameObject;
        Miniature = Planet.transform.Find("Miniature").GetComponent <Miniature>();
        objBat    = Planet.transform.Find("Miniature/BatteryF").gameObject;
        Builds    = Planet.transform.Find("Up").GetComponentsInChildren <Builds>();

        cameraUpDown = objEl.GetComponent <CameraUpDown>();

        BuySourse   = Planet.transform.Find("Up").GetComponent <AudioSource>();
        BonusSourse = Planet.transform.Find("Mines").GetComponent <AudioSource>();
        MineSource  = Planet.GetComponent <AudioSource>();
        CrashSource = Planet.transform.Find("Up/Forest").GetComponent <AudioSource>();
        BtnSource   = GameObject.Find("CanvasUI").GetComponent <AudioSource>();
        DynSource   = Planet.transform.Find("bgPlanet0").GetComponent <AudioSource>();
        ErrorSource = GameObject.Find("SL").GetComponent <AudioSource>();


        Elevator = objStock.GetComponent <Elevator>();
        Factory  = objFac.GetComponent <Factory>();
        Rocket   = objRock.GetComponent <Rocket>();

        btnL               = objLab.transform.Find("Btn").gameObject;
        iconBtnL           = btnL.transform.GetComponentInChildren <Button>();
        btnE               = objStock.transform.Find("Btn").gameObject;
        iconBtnE           = btnE.transform.GetComponentInChildren <Button>();
        btnF               = objFac.transform.Find("Btn").gameObject;
        iconBtnF           = btnF.transform.GetComponentInChildren <Button>();
        btnR               = objRock.transform.Find("Btn").gameObject;
        iconBtnR           = btnR.transform.GetComponentInChildren <Button>();
        table              = GetComponent <Table>();
        objRegTableCont    = objTable.transform.Find("RegisterContent").gameObject;
        objBonusTableCont  = objTable.transform.Find("BonusContent").gameObject;
        objRatingTableCont = objTable.transform.Find("RatingContent").gameObject;

        displayPlayers = Rating.GetComponent <DisplayPlayers>();
        ContentRating  = Rating.transform.Find("Scroll View/Viewport/Content");

        addUser = Rating.GetComponent <AddUser>();

        cameraMove.enabled = false;

        //  table.Load();
        // cameraUpDown.Load();
        // PlanetInfo.Load();
        // SL.Load();
        //Score.Load();

        rCam.SetActive(false);
        sCam.SetActive(false);
        pCam.SetActive(false);

        Planet.SetActive(false);
        Rating.SetActive(false);

        CanvasRating.SetActive(false);
        CanvasPlanet.SetActive(false);

        objTable.SetActive(false);
        objBlack.SetActive(false);
        objHint.SetActive(false);

        objBonusF.SetActive(false);
        objBonusR.SetActive(false);
        objBonusC.SetActive(false);
    }
Esempio n. 60
0
 public void AddPlanet(Planet planet)
 {
     planets.Add(planet);
 }