Exemplo n.º 1
0
 public override void OnEnter()
 {
     PersistentDataManager.LevelWillBeUnloaded();
     Finish();
 }
Exemplo n.º 2
0
    public static void Create()
    {
        GameObject obj = new GameObject("PersistentDataManager");

        s_Instance = obj.AddComponent <PersistentDataManager>();
    }
 void OnEnable()
 {
     PersistentDataManager.RegisterPersistentData(this.gameObject);
 }
 void OnEnable()
 {
     PersistentDataManager.RegisterPersister(this);
 }
Exemplo n.º 5
0
 public override void OnEnter()
 {
     PersistentDataManager.Record();
     Finish();
 }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     inputs = GameObject.Find("GameManager").GetComponent <InputManager>();
     persistentDataManager = GameObject.Find("PersistentDataManager").GetComponent <PersistentDataManager>();
     spriteRenderer        = GetComponent <SpriteRenderer>();
 }
Exemplo n.º 7
0
 public void BuyGems(int purchaseAmount)
 {
     PersistentDataManager.ChangeCurrency(DataManager.DATA_CURRENCY_TYPE_GEMS, purchaseAmount);
     gemsText.text = PersistentDataManager.GetCurrency(DataManager.DATA_CURRENCY_TYPE_GEMS).ToString();
 }
Exemplo n.º 8
0
 void Awake()
 {
     Initialize(this);
     PersistentDataManager.RegisterPersister(this);
 }
Exemplo n.º 9
0
 public void LaunchGame()
 {
     PersistentDataManager.StartNewGame(NewGameChoices);
     UnityEngine.SceneManagement.SceneManager.LoadScene("main", UnityEngine.SceneManagement.LoadSceneMode.Single);
 }
 public void SetForceResetGame(bool forceResetGame)
 {
     this.forceResetGame = forceResetGame;
     PersistentDataManager.SetDirty(this);
 }
Exemplo n.º 11
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);
    }
Exemplo n.º 12
0
 // Start is called before the first frame update
 void Start()
 {
     persistentDataManager = GameObject.Find("PersistentDataManager").GetComponent <PersistentDataManager>();
     persistentDataManager.StartTime();
 }
Exemplo n.º 13
0
 public void Save()
 {
     PersistentDataManager.SetDirty(this);
 }
Exemplo n.º 14
0
 private void OnEnable()
 {
     PersistentDataManager.RegisterPersister(this);
     itemSet.onListChange += OnItemListChange;
 }
Exemplo n.º 15
0
 void Start()
 {
     PersistentDataManager.LoadData();
 }
Exemplo n.º 16
0
 private void OnEnable() => PersistentDataManager.LoadPersistedData(this);
Exemplo n.º 17
0
 private void Awake()
 {
     PersistentDataManager.RegisterPersister(this);
 }
 private void OnDisable() => PersistentDataManager.SavePersistedData(this);
Exemplo n.º 19
0
 public void BuyCash(int purchaseAmount)
 {
     PersistentDataManager.ChangeCurrency(DataManager.DATA_CURRENCY_TYPE_CASH, purchaseAmount);
     cashText.text = PersistentDataManager.GetCurrency(DataManager.DATA_CURRENCY_TYPE_CASH).ToString();
 }
        private void OnEnable()
        {
            PersistentDataManager.LoadPersistedData(this);

            jumpfx.transform.parent = null;
        }
Exemplo n.º 21
0
 private void OnDestroy()
 {
     PersistentDataManager.UnregisterPersister(this);
 }
Exemplo n.º 22
0
 public override void OnEnter()
 {
     PersistentDataManager.Apply();
     Finish();
 }
 void OnDisable()
 {
     PersistentDataManager.UnregisterPersister(this);
 }
Exemplo n.º 24
0
    void OnDisable()
    {
        PersistentDataManager.UnregisterPersister(this);

        instance = null;
    }
Exemplo n.º 25
0
    public static void SaveLuaEnvironment()
    {
        string luaEnvironment = PersistentDataManager.GetSaveData();

        PlayerPrefs.SetString(Consts.VariableName.luaEnvironmentData, luaEnvironment);
    }
Exemplo n.º 26
0
    void FillList() //Instantiates an itemholder object into the grid in the UI
    {
        //int[] loadData = PersistentDataManager.GetItemAmounts ();
        PersistentDataManager.LoadData();
        for (int i = 0; i < itemList.Count; i++)
        {
            GameObject holder       = Instantiate(ItemHolderPrefab, grid, false);
            ItemHolder holderScript = holder.GetComponent <ItemHolder>(); //Gain acces to the stuff in ItemHolder(the individual info of each item).

            holderScript.itemName.text  = itemList[i].ItemName;
            holderScript.itemPrice.text = itemList[i].ItemPrice.ToString();
            holderScript.itemID         = itemList[i].ItemID;
            holderScript.amount.text    = PersistentDataManager.GetItemAmount(i).ToString();

            if (holderScript.amount.text == "0")
            {
                holderScript.amount.text = "";
                holderScript.bar1.SetActive(false);
                holderScript.bar2.SetActive(false);
                holderScript.bar3.SetActive(false);
                holderScript.bar4.SetActive(false);
                holderScript.bar5.SetActive(false);
            }
            if (holderScript.amount.text == "1")
            {
                holderScript.bar1.SetActive(true);
            }
            if (holderScript.amount.text == "2")
            {
                holderScript.bar1.SetActive(false);
                holderScript.bar2.SetActive(true);
            }
            if (holderScript.amount.text == "3")
            {
                holderScript.bar2.SetActive(false);
                holderScript.bar3.SetActive(true);
            }
            if (holderScript.amount.text == "4")
            {
                holderScript.bar3.SetActive(false);
                holderScript.bar4.SetActive(true);
            }
            if (holderScript.amount.text == "5")
            {
                holderScript.bar4.SetActive(false);
                holderScript.bar5.SetActive(true);
            }
            //the buy button
            holderScript.buyButton.GetComponent <BuyButton>().itemID = itemList[i].ItemID;

            //The list to update the sprite
            ItemHolderList.Add(holder);
            buyButtonList.Add(holderScript.buyButton); //keeps track of whihc button.

            itemList [i].bought = PersistentDataManager.GetItemAmount(i) > 0?true:false;
            if (itemList[i].bought == true)
            {                                                                                                 //v----the sub directory.
                holderScript.itemImage.sprite = Resources.Load <Sprite>("Sprites/" + itemList[i].SpriteName); //Goes to the Resources directory to grab the right sprites.
            }
            else
            {
                holderScript.itemImage.sprite = Resources.Load <Sprite>("Sprites/" + "Lock" + itemList[i].SpriteName); //I manually change the sprite we getting by adding "Lock" to name
                                                                                                                       //Since all my locked versions are same name but Locked at start of string
                                                                                                                       //ex: Clock and LockClock
            }
        }
    }
Exemplo n.º 27
0
 private void Start()
 {
     INSTANCE = this;
 }
Exemplo n.º 28
0
 public void Choice(int choiceIndex, char decision)
 {
     PersistentDataManager.SetData(choiceIndex, decision);
 }
Exemplo n.º 29
0
        void OnDisable()
        {
            OnRecordPersistentData();

            PersistentDataManager.RegisterPersistentData(this.gameObject);
        }
Exemplo n.º 30
0
 void OnEnable()
 {
     VariableName = name + transform.position.x.ToString("F2") + transform.position.ToString("F2");
     print(VariableName);
     PersistentDataManager.RegisterPersistentData(this.gameObject);
 }