Esempio n. 1
0
    private void ResetAllDatas()
    {
        for (int i = 0; i < AllSpinners.Length; i++)
        {
            SpinerData spiner = AllSpinners[i];

            spiner.IsBought     = false;
            spiner.NowCountRang = 0;
            spiner.NowRang      = 0;
        }

        Settings.AllRangs = 0;
        Settings.AllCoins = 0;
    }
Esempio n. 2
0
    private void Start()
    {
        if (Settings.NowChoosedSpiner == null)
        {
            SceneManager.LoadScene(0);
        }

        // Instalation
        MR  = FindObjectOfType <MoveRotate>();
        CKZ = FindObjectOfType <CreateKillZones>();

        TextScore.text     = "";
        CoinsHereText.text = "";

        Panelover.SetActive(false);

        NowChoosedSpiner = Settings.NowChoosedSpiner;
    }
Esempio n. 3
0
    private void GetSave()
    {
        ResetAllDatas();

        if (PlayerPrefs.HasKey("CountBS"))
        {
            for (int i = 0; i < PlayerPrefs.GetInt("CountBS"); i++)
            {
                for (int g = 0; g < AllSpinners.Length; g++)
                {
                    if (AllSpinners[g].ID == PlayerPrefs.GetString("BSID" + i))
                    {
                        SpinerData spiner = AllSpinners[g];

                        BoughtSpiners.Add(spiner);
                        spiner.IsBought = true;

                        if (PlayerPrefs.HasKey("NowRang" + spiner.ID))
                        {
                            spiner.NowRang = PlayerPrefs.GetInt("NowRang" + spiner.ID);
                        }
                        if (PlayerPrefs.HasKey("NowCountRang" + spiner.ID))
                        {
                            spiner.NowCountRang = PlayerPrefs.GetInt("NowCountRang" + spiner.ID);
                        }
                        break;
                    }
                }
            }
        }
        if (PlayerPrefs.HasKey("AllRangs"))
        {
            Settings.AllRangs = PlayerPrefs.GetInt("AllRangs");
            AllRangsText.text = Settings.AllRangs.ToString();
        }
        if (PlayerPrefs.HasKey("AllCoins"))
        {
            Settings.AllCoins = PlayerPrefs.GetInt("AllCoins");
            AllCoinsText.text = Settings.AllCoins.ToString();
        }
    }
Esempio n. 4
0
    private void ShowInfoSpiner(SpinerData spinerData)
    {
        // Set texts
        NameSpinerText.text = spinerData.Name;
        // Set buttons
        Buy_but.onClick.RemoveAllListeners();
        Go_but.onClick.RemoveAllListeners();

        Buy_but.interactable = !spinerData.IsBought;
        Go_but.interactable  = spinerData.IsBought;

        // Show mesh
        MeshFilter MF = SpinerShowObject.GetComponent <MeshFilter>();

        MF.mesh = spinerData.MeshSpiner;

        if (!spinerData.IsBought)
        {
            Buy_but.onClick.AddListener(delegate { TakeSpiner(spinerData); ShowInfoSpiner(spinerData); });
        }
        else
        {
            Go_but.onClick.AddListener(delegate { Go(spinerData); });
        }

        // Show level parametrs
        CountRang CR = Settings.AviableRangs[spinerData.NowRang];

        RangNowSlider.maxValue = CR.CountToHave;
        RangNowSlider.value    = spinerData.NowCountRang;

        if (CR.AvatarRang != null)
        {
            RangLevelimg.sprite = CR.AvatarRang;
        }
    }
Esempio n. 5
0
 public void Go(SpinerData spinerData)
 {
     Settings.NowChoosedSpiner = spinerData;
     SceneManager.LoadScene(1);
 }
Esempio n. 6
0
 public void TakeSpiner(SpinerData spinerData)
 {
     BoughtSpiners.Add(spinerData);
     spinerData.IsBought = true;
     Save();
 }