Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        Universe uni = Universe.Instance;

        uni.AddSolarSystem();

        for (int i = 0; i < uni.Systems.Count; i++)
        {
            // Iterate through Solar systems
            SolarSystem curr_sys = uni.Systems[i];
            for (int j = 0; j < curr_sys.Bodies.Count; j++)
            {
                // Get the Body
                PlanetaryBody curr_body = curr_sys.Bodies[j];

                // Get the position
                bool    isStar  = curr_body is Star;
                Vector3 bodyPos = RandomCartesianPosition(isStar, j);

                // Create the Game Object
                GameObject bodyGO = CreateBodyGameObject(bodyPos, curr_body, isStar);

                // Create the orbit
                GameObject orbitGO = CreateOrbitPath(curr_body.Name + "Orbit", j + 1, this.gameObject);

                // Add it to our Dict
                curr_sys.BodyToObjectMap.Add(curr_sys.Bodies[j], bodyGO);
            }
        }

        ac = FindObjectOfType <AudioController>();
        if (ac == null)
        {
            Debug.LogError("No Audio Controller found!!");
        }

        foreach (VictoryCondition vic in FindObjectsOfType <VictoryCondition>())
        {
            Debug.Log("We found one!");
            victories.Add(vic);
        }

        player = FindObjectOfType <PlayerManager>();
        if (player == null)
        {
            throw new System.Exception("No player found!");
        }

        screen = FindObjectOfType <ScreenManager>();
        if (screen == null)
        {
            throw new System.Exception("No Screen found!");
        }

        UpdateColonisedPlanets();
    }