Ejemplo n.º 1
0
    IEnumerator LoadGalaxyMapRoutine(string galaxyMapName)
    {
        yield return(SceneManager.LoadSceneAsync("Sandbox/Scenes/GalaxyMaps/" + galaxyMapName, LoadSceneMode.Additive));

        GalaxyMapVisual = FindObjectOfType <GalaxyMapVisual>();
        GalaxyMapVisual.Setup(this, galaxySeed);

        GalaxyMapCamera = FindObjectOfType <GalaxyMapCamera>();
        GalaxyMapCamera.gameObject.SetActive(false);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    IEnumerator Start()
    {
        switch (simulationMode)
        {
        case SimulationMode.A:
            yield return(LoadGalaxyMapRoutine("GalaxyMapA"));

            break;

        case SimulationMode.B:
            yield return(LoadGalaxyMapRoutine("GalaxyMapB"));

            break;

        case SimulationMode.C:
            yield return(LoadGalaxyMapRoutine("GalaxyMapC"));

            break;
        }

        GalaxyMapNode defaultNode = GalaxyMapVisual.GetDefaultNode();

        if (defaultNode == null)
        {
            defaultNode = FindObjectOfType <GalaxyMapNode>();
        }
        yield return(LoadSolarSystemSceneRoutine(defaultNode.name));

        ship = Instantiate(shipPrefab, transform).GetComponent <Ship>();
        ship.Setup(this);

        StartingLocation startingLocation = FindObjectOfType <StartingLocation>();

        externalCamera = Instantiate(externalCameraPrefab, transform).GetComponent <ExternalCamera>();
        externalCamera.Setup(ship.transform);

        DynamicObjectsRoot = new GameObject("DynamicObjectsRoots").transform;
        DynamicObjectsRoot.SetParent(transform);
    }
Ejemplo n.º 3
0
    IEnumerator SolarSystemSwapRoutine(string destinationGalaxyMapNodeName)
    {
        string startingSolarSystemName = currentSolarSystemName;

        yield return(UnloadCurrentSolarSystemSceneRoutine());

        yield return(LoadSolarSystemSceneRoutine(destinationGalaxyMapNodeName));

        currentSolarSystemName = destinationGalaxyMapNodeName;

        //Move ship on top of arrival gate
        ship.GetComponent <Rigidbody2D>().velocity        = Vector2.zero;
        ship.GetComponent <Rigidbody2D>().angularVelocity = 0f;
        foreach (var gate in FindObjectsOfType <WarpGate>())
        {
            GalaxyMapNode sourceNode = GalaxyMapVisual.FindDestinationNodeForWarpGate(gate);
            if (sourceNode != null && sourceNode.name == startingSolarSystemName)
            {
                ship.transform.position = gate.transform.position + Vector3.right * 10f;
            }
        }

        isTransitioningScenes = false;
    }
Ejemplo n.º 4
0
 private void Start()
 {
     gameCore  = GetComponentInParent <GameCore>();
     galaxyMap = FindObjectOfType <GalaxyMapVisual>();
 }