void Awake()
	{      
        PathFinding = GameObject.FindWithTag("PathFinding");
        if(PathFinding) sphericalGrid = PathFinding.GetComponent<SphericalGrid>();
        planetBody = GetComponent<PlanetBody>();
		target = new GameObject ().transform;
        target.name = "PathfindingTarget";
	}
Example #2
0
    void CreateSolarSystem()
    {
        //Planet size and moon number needs to be recorded so that each planet
        //can be offset and no overlapping orbits occur.
        float zPosOffset = 5;        //Start offset to move planet away from star

        for (int i = 0; i < Random.Range(3, 6); i++)
        {
            int  planetSize    = Random.Range(5, 15);
            int  numberOfMoons = Random.Range(0, 4);
            bool hasRing       = (Random.Range(0, 3) == 0);

            zPosOffset += planetSize * 2.5f;
            zPosOffset += (numberOfMoons * 3) + 10;            //Same offset used in the PlanetBody's moon creation.
            zPosOffset += (hasRing) ? 7.5f : 2f;

            ICelestialBody planet = new PlanetBody(sun, planetSize, zPosOffset, hasRing, numberOfMoons);
            planets.Add(planet);
        }

        //Set the values for the camera and ui (cam and ui are tightly coupled)
        cameraControl.SetCamRestrictions(zPosOffset);
        uiControl.UpdatePlanetList(planets);
    }
Example #3
0
    void Awake()
    {
        mPlanetBody = GetComponent<PlanetBody>();

        enemyCount = 0;
    }
	void Awake()
	{
		planetBody = GetComponent<PlanetBody>();
	}
Example #5
0
    void Awake()
    {
        mPlanetBody = GetComponent <PlanetBody>();

        enemyCount = 0;
    }