Ejemplo 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
    }
Ejemplo n.º 2
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);
    }