Exemple #1
0
    // Use this for initialization
    void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;

            scoreLimits.Add(2500);
            scoreLimits.Add(3500);
            scoreLimits.Add(4500);
            scoreLimits.Add(5500);

            // Loading the coin count to allow easy incrementation and saving
            coinCount = internalMemory.loadCoinCount();

            //Doing the same for high score
            currentHighScore = internalMemory.loadHiScore();

            //Getting the current shop data from internal memory
            if (internalMemory.isShopDataValid())
            {
                cacheShop();
            }
            else //Setting up the default shop data if this is the first play (or if file got corrupted)...
            {
                setUpShop();
            }
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }
    }
    // Diabling the pointer if the game has been player before
    void Start()
    {
        internalMemoryManager myIMM = new internalMemoryManager();

        gameObject.SetActive(myIMM.loadHiScore() == 0);
    }