Ejemplo n.º 1
0
    public static TweenRotation ResetTween(TweenRotation twn)
    {
        #if USE_UI_NGUI_3
        twn.ResetToBeginning();
        #else
        twn.Reset();
        #endif

        return(twn);
    }
Ejemplo n.º 2
0
    private void SetType(int type)
    {
        SetAllDisable();
        switch (type)
        {
        case 1:
            SoundManager.PlaySound("Enhanced_enemyimpact1.ogg");
            m_jinzhanatk.SetActive(true);
            break;

        case 2:
            SoundManager.PlaySound("Enhanced_enemyimpact2.ogg");
            m_yuanchengatk.SetActive(true);
            break;

        case 3:
            SoundManager.PlaySound("LaserMine_Explode.ogg");
            m_gongchengatk.SetActive(true);
            break;

        case 4:
            SoundManager.PlaySound("Enhanced_enemyimpact3.ogg");
            m_anshaatk.SetActive(true);
            break;

        case 5:
            SoundManager.PlaySound("Enhanced_enemyimpact1.ogg");
            m_stjinzhanatk.SetActive(true);
            break;

        case 6:
            SoundManager.PlaySound("Enhanced_enemyimpact2.ogg");
            m_styuanchengatk.SetActive(true);
            break;

        case 7:
            SoundManager.PlaySound("Launch_1.ogg");
            m_toweratk.SetActive(true);
            break;

        case 8:    //hit
            m_hit.SetActive(true);
            m_hitScale.Reset();
            m_hitAlpha.Reset();
            m_hitRot.Reset();
            m_hitScale.Play(true);
            m_hitAlpha.Play(true);
            m_hitRot.Play(true);
            break;

        default:
            break;
        }
    }
    void ResetTimer(float amount = -1.0f)
    {
        //Set the timer amount if one is applied.
        if (amount != -1.0f)
        {
            TweenTimer.duration = amount;
        }

        TweenTimer.Reset();
        TweenTimer.Play(true);
    }
    void OnTimerDone()
    {
        //	Debug.Log("ON TIMER!");

        //If this is set to true when timer is done.
        if (gamereviewtrigger)
        {
            //Lets play the game review music here... sure...
            AudioPlayer.GetPlayer().PlayAudioClip(GameReviewMusic);
        }

        if (curState == state.Present && !PPSButton.gameObject.activeSelf)
        {
            PPSButton.gameObject.SetActive(true);
            ScoreButtonIntro.Reset();
            ScoreButtonIntro.Play(true);

            Animal.gameObject.SetActive(true);

            if (IncommingPPS)
            {
                AudioPlayer.GetPlayer().PlaySound(IncommingPPS);
            }

            presented = true;

            //Set the game review and timer
            gamereviewtrigger = true;

            float t = AudioPlayer.GetPlayer().RemainingTime;
            ResetTimer(t);



            //Debug.LogError("Track change timer set :" + t.ToString());
        }

        //Close the curtains here.
        if (curState == state.GameOver)
        {
            curState = state.CloseCurtain;

            //Hide the hud.
            ActivityManager.Instance.ToggleHud(false);

            //Pull curtain
            ActivityManager.Instance.PullCurtain();

            //Pause the game
            ToyBox.GetPandora().TimePaused = true;

            ResetTimer(localDuration * 2.0f);
        }

        //This is when we finish displaying the game over sign.
        if (curState == state.CloseCurtain)
        {
            GameOverWindow.SetWindowAlpha(0.0f);
            GameOverWindow.ToggleWindowOff();

            PhasesCountWindow.ToggleWindowOn();
            //BG.ToggleWindowOn();

            curState = state.Count;
            //Set the tween animation for badges.
            BadgesGridTween.Reset();

            ResetTimer(localDuration);
        }


        if (curState == state.Scores)
        {
            switch (ScoresState)
            {
            //Present coins.
            case 0:
            {
                MoneyLabel.alpha = 1.0f;
                MoneyTween.Reset();
                MoneyTween.Play(true);

                AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.CashRegister);
                break;
            }

            //Present score
            case 1:
            {
                ScoreLabel.alpha = 1.0f;
                PointsTween.Reset();
                PointsTween.Play(true);

                AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect);
                break;
            }

            //Present Bonus
            case 2:
            {
                BonusLabel.alpha = 1.0f;
                BonusTween.Reset();
                BonusTween.Play(true);

                AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect);
                break;
            }


            default:
            {
                break;
            }
            }


            ScoresState++;
            if (ScoresState > 3)
            {
                curState = state.Present;
                ResetTimer(localDuration);
                return;
            }


            //Resetting the timer after being displayed.
            ResetTimer();
            return;
        }


        if (curState == state.Count)
        {
            int index = 0;
            foreach (FUIPhaseResultObject badge in _resultList)
            {
                //If we hit a badge with null data then we are finished and change state.
                //Testing, should be a test if there is valid phase data.
                if (badge.PhaseData == null)
                {
                    curState = state.Scores;

                    //Play animation and sound effects.
                    BadgesGridTween.Play(true);
                    AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotPushed);

                    //Turn on windows here.
                    PhasesCountWindow.ToggleWindowOn();
                    BG.ToggleWindowOn();

                    ResetTimer();
                    return;
                }

                if (!badge.gameObject.activeSelf)
                {
                    //Repositioning on the start too aparently...
                    panel.ResetPosition();

                    //Else we will activate the current object, reset the timer, and return from the function.
                    badge.gameObject.SetActive(true);

                    //Repositioning
                    EndGameTable.Reposition();
                    panel.ResetPosition();

                    //Resetting the timer after being displayed.
                    ResetTimer();

                    if (IncommingPhase)
                    {
                        AudioPlayer.GetPlayer().PlaySound(IncommingPhase);
                    }

                    return;
                }

                index++;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        //Grab data from GOT
        int   newmultiplier = GameObjectTracker.GetGOT().GetMultiplier();
        int   newGems       = GameObjectTracker.instance.GetGemsCollected();
        float alpha         = GameObjectTracker.GetGOT().GetComboAlpha();

        //Set the bank amount.
        float gemcount = (float)newGems;

        gemcount = gemcount / 100.0f;
        string gemFormat = string.Format("{0:C}", gemcount);

        Bank.text = gemFormat;

        //Set the phase icon.
        //CurrentPhaseIcon.spriteName = GameObjectTracker.GetGOT().Game

        if (alpha < CloseBuffer && visible)
        {
//			Debug.LogError("alpha: " + alpha);

            MyAnimation.Play(false);
            visible = false;
        }

        if (newmultiplier == 0)
        {
            //Set previous multiplier.
            prevMultiplier = 0;

            //If we are visible play our animation
            //Dont process any more.
            return;
        }

        //Turn out counter if we go past 0 and is not visible.
        if (alpha > CloseBuffer && !visible)
        {
            //MyAnimation.Reset();
            MyAnimation.Play(true);
            visible = true;
        }


        //If we are changed then trigger counter pop.
        if (newmultiplier > prevMultiplier)
        {
            Counter.text = newmultiplier.ToString();

            //Set the shadow
            PrevCounter.text = Counter.text;


            CounterPop.Reset();
            CounterPop.Play(true);
        }



        //Update gem colleciton
        if (newGems != prevGems)
        {
            //Format collect amount text to money.
            float collect = (float)newmultiplier;
            collect = collect / 100.0f;
            string collectCount = string.Format("+{0:C}", collect);

            //Set the text
            CollectCount.text = collectCount;

            //CollectCount.alpha = 1.0f;
            CollectAnimation.Reset();
            CollectAnimation.Play(true);

            //AlphaAni.Reset();
            AlphaAni.Play(true);


            BankAnimation.Reset();
            BankAnimation.Play(true);

            prevGems = newGems;
        }

        //Fill up the outline!
        Outline.fillAmount = alpha;
        Outline.color      = Color.Lerp(Color.red, Color.white, alpha);



        Quaternion qrot = Quaternion.identity;

        float ClockAngle = Mathf.Lerp(359, 0, alpha);

        qrot = Quaternion.AngleAxis(ClockAngle, Vector3.forward);

        //ClockBigHand.


        ClockBigHand.transform.localRotation = qrot;


        //Update the muliplier.
        int currentMultiplierModifier = GameObjectTracker.instance.Game.GetCurrentMultiplierModifier();

        Multiplier.text = "x" + currentMultiplierModifier;

        // we dont want to show a x0 for gameover
        if (currentMultiplierModifier == 0)
        {
            //MyAnimation.Reset();
            //MyAnimation.Play(false);
        }

        //Set prev multiplier
        prevMultiplier = newmultiplier;
    }