Exemplo n.º 1
0
    void Start()
    {
#if !(UNITY_IOS || UNITY_ANDROID)
        postBestsBtn.SetActive(false);
#endif

        bgCtrl  = GetComponent <BackgroundController>();
        tbCtrl  = GetComponent <TableController>();
        camCtrl = GetComponent <CameraController>();

        music      = GetComponent <AudioSource> ();
        music.loop = true;

        persistorObj         = GameObject.Find("Persistor");
        audioCtrl            = persistorObj.GetComponent <AudioController>();
        AudioListener.volume = audioCtrl.CurrVolume;

        adCtrl     = GameObject.Find("Persistor").GetComponent <AdController>();
        adLaunched = false;

        // Make sure to incorporate SCALE!!!
        player      = playerObj.GetComponent <Player>();
        prevFlipAcc = Player.FlipAccuracy.none;

        highFlips        = 0;
        highScore        = 0;
        highComboOverall = 0;

        bgCtrl.OnLoad();
        tbCtrl.OnLoad();

        Reset();
    }
Exemplo n.º 2
0
    void OnFlip(Player.FlipAccuracy flipAcc)
    {
        flips++;

        UpdateComboVal(flipAcc);
        score += comboVal;

        guiCtrl.UpdateHUD(score, comboVal);

        // Track high-combo-by-round here as it can decrease during the game
        if (comboVal > highComboThisRound)
        {
            highComboThisRound = comboVal;
        }

        // If flips hits a certain number, increase speeds, flip force, etc.
        // Use tables flipped, not score, as that can increase like crazy.
        if (flips % 10 == 0)
        {
            tbCtrl.PatternChange();
        }
        else if (flips % 5 == 0)
        {
            speed += 0.5f;
            tbCtrl.SpeedIncrease();
            player.SpeedIncrease();
        }

        // ACHIEVEMENT CHECKS

        if (flipAcc == prevFlipAcc)
        {
            flipAccAchieveCounter++;
            if (flipAccAchieveCounter == Constants.ACH_FLIP_ACC_COUNT - 1)
            {
                if (flipAcc == Player.FlipAccuracy.perf)
                {
                    guiCtrl.UpdateAchievement(Constants.ACH_FOCUSED_FLIPPER, "Achievement: Focused Flipper");
                }
                else if (flipAcc == Player.FlipAccuracy.good)
                {
                    guiCtrl.UpdateAchievement(Constants.ACH_GOOD_GRIP, "Achievement: Good Grip");
                }
                else if (flipAcc == Player.FlipAccuracy.meh)
                {
                    guiCtrl.UpdateAchievement(Constants.ACH_MESSY_MAYHEM, "Achievement: Messy Mayhem");
                }
            }
        }
        else
        {
            flipAccAchieveCounter = 1;
        }
        prevFlipAcc = flipAcc;

        if (score > Constants.ACH_TABLE_TIRADE_SCORE - 1 || flips > Constants.ACH_TABLE_TIRADE_FLIPS - 1)
        {
            guiCtrl.UpdateAchievement(Constants.ACH_TABLE_TIRADE, "Achievement: Table Tirade");
        }
    }
Exemplo n.º 3
0
    void UpdateComboVal(Player.FlipAccuracy flipAcc)
    {
        if (flipAcc == Player.FlipAccuracy.perf)
        {
            comboVal++;
        }
        else if (flipAcc == Player.FlipAccuracy.meh)
        {
            comboVal = 1;
        }

        if (comboVal < 1)
        {
            comboVal = 1;
        }
    }