Exemplo n.º 1
0
    //this will always execute
    void Awake()
    {
        Instance = this;
#if UNITY_EDITOR
        if (Game.Current == null)
        {
            bool isTutorial = SceneManager.GetActiveScene().buildIndex == 2;

            if (!isTutorial)
            {
                print("Starting new game for editor session");
                var boughtMatter = new BoughtMatter();
                boughtMatter.Set(RedHomestead.Simulation.Matter.Water, 1);
                boughtMatter.Set(RedHomestead.Simulation.Matter.Oxygen, 1);
                boughtMatter.Set(RedHomestead.Simulation.Matter.Hydrogen, 2);

                PersistentDataManager.StartNewGame(new RedHomestead.GameplayOptions.NewGameChoices()
                {
                    PlayerName     = "Ares",
                    ChosenLocation = new RedHomestead.Geography.BaseLocation()
                    {
                        Region = RedHomestead.Geography.MarsRegion.meridiani_planum
                    },
                    ChosenFinancing      = RedHomestead.Economy.BackerFinancing.Government,
                    BuyRover             = true,
                    ChosenPlayerTraining = RedHomestead.Perks.Perk.Athlete,
                    RemainingFunds       = 1000000,
                    BoughtMatter         = boughtMatter,
                    BoughtCraftables     = new System.Collections.Generic.Dictionary <RedHomestead.Crafting.Craftable, int>(),
                    IsTutorial           = isTutorial
                });
            }
        }
#endif
    }
Exemplo n.º 2
0
 public void StartTutorial()
 {
     NewGameChoices.IsTutorial     = true;
     NewGameChoices.ChosenLocation = new BaseLocation();
     PersistentDataManager.StartNewGame(NewGameChoices);
     UnityEngine.SceneManagement.SceneManager.LoadScene("tutorial", UnityEngine.SceneManagement.LoadSceneMode.Single);
 }
Exemplo n.º 3
0
    public void StartQuickstart()
    {
        PersistentDataManager.StartNewGame(NewGameChoices);
#warning todo: make sure quickstart at quickstart equipment/training
        this.NewGameChoices.LoadQuickstart();
        LaunchGame();
    }
Exemplo n.º 4
0
 public void LaunchGame()
 {
     PersistentDataManager.StartNewGame(NewGameChoices);
     UnityEngine.SceneManagement.SceneManager.LoadScene("main", UnityEngine.SceneManagement.LoadSceneMode.Single);
 }
Exemplo n.º 5
0
    private void Reset()
    {
        var boughtMatter = new BoughtMatter();

        //boughtMatter.Set(RedHomestead.Simulation.Matter.Water, 1);
        //boughtMatter.Set(RedHomestead.Simulation.Matter.Oxygen, 1);
        //boughtMatter.Set(RedHomestead.Simulation.Matter.Hydrogen, 2);

        PersistentDataManager.StartNewGame(new RedHomestead.GameplayOptions.NewGameChoices()
        {
            PlayerName     = "Ares",
            ChosenLocation = new RedHomestead.Geography.BaseLocation()
            {
                Region = RedHomestead.Geography.MarsRegion.meridiani_planum
            },
            ChosenFinancing      = RedHomestead.Economy.BackerFinancing.Government,
            BuyRover             = true,
            ChosenPlayerTraining = RedHomestead.Perks.Perk.Athlete,
            RemainingFunds       = 1000000,
            BoughtMatter         = boughtMatter,
            BoughtCraftables     = new System.Collections.Generic.Dictionary <RedHomestead.Crafting.Craftable, int>(),
            IsTutorial           = true
        });
        SurvivalTimer.Instance.Start();
        Hab.Start();
        PlayerInput.Instance.Start();
        var movables = FindObjectsOfType <MovableSnappable>();

        foreach (MovableSnappable movable in movables)
        {
            if (movable.transform == Toolbox.transform)
            {
                continue;
            }
            else
            {
                GameObject.Destroy(movable.transform.gameObject);
            }
        }
        var modules = FindObjectsOfType <ModuleGameplay>();

        foreach (ModuleGameplay module in modules)
        {
            if (module.transform == Hab.transform || module.transform == LZ.transform || module.transform == RTG.transform)
            {
                continue;
            }
            else
            {
                GameObject.Destroy(module.gameObject);
            }
        }
        if (LZ.Cargo != null)
        {
            LZ.Cargo.EmergencyDisable();
        }

        if (Rover != null)
        {
            Rover.transform.position = RoverStartPosition;
        }
        Player.transform.position  = PlayerStartPosition;
        Toolbox.transform.position = ToolboxStartPosition;

        EventPanel.Group.gameObject.SetActive(false);
        Arrow.gameObject.SetActive(false);
        RTG.gameObject.SetActive(false);
        RTGPowerArrow.gameObject.SetActive(false);
        HabPowerArrow.gameObject.SetActive(false);
    }