// Use this for initialization
    void Start()
    {
        // Singleton Behaviour
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        // TODO TESTING
        Inventory = new List <int> ();
        Collected = new Dictionary <int, int> ();
        // { { 2, 3 }, { 4, 1 }, { 6, 2 }, { 9, 0 }, { 10, 1 }, { 11, 2 }, { 18, 2 } };
        RecipesUnlocked = new Dictionary <int, int> ();
        // {{1, 1}, {4, 0}};
        Stats = new List <int>()
        {
            0, 0, 0
        };
        SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked> ();
    }
    // Use this for initialization
    void Start()
    {
        // Singleton Behaviour
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
        Debug.Log("shop start");
        shopUnlockedList = new List <int> ()
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        };

        // Linking
        IC = GameObject.FindGameObjectWithTag("InventoryController").GetComponent <InventoryController>();

        // Shop Upgrades
        // 0-2 Opens 1 more crate
        // 3 unlocks casino scog lotto
        // 4 luck tweaked
        // 5 retro game
        // 6 unlocks player 1 z ground
        // 7 achievement (cali or bust)
        // 8 secondary shop

        int numUpgrades = 9;         // TODO increase
    }
Exemplo n.º 3
0
    // Shop Upgrades
    // 1-3 Opens 1 more crate
    // 4 unlocks casino scog lotto
    // 5 luck tweaked
    // 6 retro game
    // 7 unlocks player 1 z ground
    // 8 achievement (cali or bust)
    // 9 secondary shop

    // Use this for initialization
    void Start()
    {
        UpgradeList = new List <GameObject> ();
        SU          = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked> ();
        SC          = GameObject.FindGameObjectWithTag("Currency").GetComponent <ShopCurrency> ();
        IC          = GameObject.FindGameObjectWithTag("InventoryController").GetComponent <InventoryController> ();
        SetupUpgrades();
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        btn = GetComponent <Button> ();
        btn.onClick.AddListener(OpenP1DG);
        // Disable if not unlocked from shop
        ShopUnlocked SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked>();

        // Casino upgrade is 3
        if (SU.CheckUpgrades(6) < 1)
        {
            Destroy(transform.parent.gameObject);
        }
    }
    // Use this for initialization
    void Start()
    {
        Button btn = GetComponent <Button> ();

        btn.onClick.AddListener(ChangeScene);
        // Disable if not unlocked from shop
        ShopUnlocked SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked>();

        // Retro upgrade is 5
        if (SU.CheckUpgrades(5) < 1)
        {
            Destroy(transform.parent.gameObject);
        }
    }
    // Use this for initialization
    void Start()
    {
        // Singleton Behaviour
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        IC = GameObject.FindGameObjectWithTag("InventoryController").GetComponent <InventoryController> ();
        SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked> ();
        Load();
    }
 // Update is called once per frame
 void Update()
 {
     // Spinlock lol not really
     if (!IC)
     {
         IC = GameObject.FindGameObjectWithTag("InventoryController").GetComponent <InventoryController> ();
     }
     if (!SU)
     {
         SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked> ();
     }
     if (counter >= limit)
     {
         Save();
         counter = 0;
     }
     counter += Time.deltaTime;
 }
    private void Update()
    {
        if (!SteamManager.Initialized)
        {
            return;
        }

        if (!m_bRequestedStats)
        {
            // Is Steam Loaded? if no, can't get stats, done
            if (!SteamManager.Initialized)
            {
                m_bRequestedStats = true;
                return;
            }

            // If yes, request our stats
            bool bSuccess = SteamUserStats.RequestCurrentStats();

            // This function should only return false if we weren't logged in, and we already checked that.
            // But handle it being false again anyway, just ask again later.
            m_bRequestedStats = bSuccess;
        }

        if (!m_bStatsValid)
        {
            return;
        }

        // Spin until it is linked
        if (IC == null)
        {
            IC = GameObject.FindGameObjectWithTag("InventoryController").GetComponent <InventoryController> ();
        }
        if (SU == null)
        {
            SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked> ();
        }

        // Get info from sources

        // Evaluate achievements
        foreach (Achievement_t achievement in m_Achievements)
        {
            if (achievement.m_bAchieved)
            {
                continue;
            }

            switch (achievement.m_eAchievementID)
            {
            case Achievement.ACH_TON:
                if (IC.getNumberOpened() >= 50)
                {
                    UnlockAchievement(achievement);
                }
                break;

            case Achievement.ACH_SOME:
                if (IC.getNumberOpened() >= 150)
                {
                    UnlockAchievement(achievement);
                }
                break;

            case Achievement.ACH_WHALE:
                if (IC.getNumberOpened() >= 1500)
                {
                    UnlockAchievement(achievement);
                }
                break;

            case Achievement.ACH_DOUBLE:
                if (IC.getHowManyToOpen() >= 2)
                {
                    print("unlocked");
                    UnlockAchievement(achievement);
                }
                break;

            case Achievement.ACH_TRIPLE:
                if (IC.getHowManyToOpen() >= 3)
                {
                    UnlockAchievement(achievement);
                }
                break;

            case Achievement.ACH_QUAD:
                if (IC.getHowManyToOpen() >= 4)
                {
                    UnlockAchievement(achievement);
                }
                break;
            }
        }

        //Store stats in the Steam database if necessary
        if (m_bStoreStats)
        {
            // already set any achievements in UnlockAchievement

            // set stats
            SteamUserStats.SetStat("NumGames", m_nTotalGamesPlayed);
            SteamUserStats.SetStat("NumWins", m_nTotalNumWins);
            SteamUserStats.SetStat("NumLosses", m_nTotalNumLosses);
            SteamUserStats.SetStat("FeetTraveled", m_flTotalFeetTraveled);
            SteamUserStats.SetStat("MaxFeetTraveled", m_flMaxFeetTraveled);
            // Update average feet / second stat
            SteamUserStats.UpdateAvgRateStat("AverageSpeed", m_flGameFeetTraveled, m_flGameDurationSeconds);
            // The averaged result is calculated for us
            SteamUserStats.GetStat("AverageSpeed", out m_flAverageSpeed);

            bool bSuccess = SteamUserStats.StoreStats();
            // If this failed, we never sent anything to the server, try
            // again later.
            m_bStoreStats = !bSuccess;
        }
    }