Ejemplo n.º 1
0
    /// <summary>
    /// This is called from any button that wants to start the slot and cannon select
    /// Toggle the activity.  first called when a button or trigger wants this activity started
    ///
    /// This will turn on and start the activity if it is off.
    /// Turn off when its on.
    /// </summary>
    public bool ToggleActivity()
    {
        // we maynot be tweened open yet.  activate the primary, and fully open with the tween
        if (_isActive)
        {
            this.TogglePanel(true);

            foreach (FUIWindowToggles window in _windows)
            {
                window.ToggleWindowOn();
            }
        }
        else
        {
            foreach (FUIWindowToggles window in _windows)
            {
                window.ToggleWindowOff();
            }
        }

        if (_myTweenTransform)
        {
            _myTweenTransform.Play(_isActive);
        }

        // not necessarily on yet if on.  has to animate before the flag is set.
        return(_isActive);
    }
Ejemplo n.º 2
0
    public void Tally(float speed = 1.0f)
    {
        exitAnimation.duration = speed;

        exitAnimation.Reset();
        exitAnimation.Play(true);
    }
    void OnBGEnter()
    {
        //Deactivate the BG
        BGTween.gameObject.SetActive(false);

        //Play the label tween animation here
        LabelTween.Play(true);
    }
    static public TweenTransform SetTransform(GameObject go, Transform transform, float duration = 1f)
    {
        TweenTransform twt = Tweener.InitGO <TweenTransform>(go, duration);

        twt.beginTransform = twt.CachedTransform;
        twt.endTransform   = transform;
        twt.Play(true);
        return(twt);
    }
Ejemplo n.º 5
0
    void NotificationIntroFinish()
    {
        //Revert back to normal time.

        NotiAnimation.Play(true);
        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.PhasePresent);

        ToyBox.GetPandora().SetSlowMotion(false);
    }
    // Update is called once per frame
    new void LateUpdate()
    {
        base.LateUpdate();

        if (!isFullyInit)
        {
            Init();
        }

        if (_haveTweenTrans && Input.GetKeyUp(KeyCode.T))
        {
            _tweenTransform.Reset();
            _tweenTransform.Play(true);
        }
        if (_haveTweenScale && Input.GetKeyUp(KeyCode.T))
        {
            _tweenScale.Reset();
            _tweenScale.Play(true);
        }
    }
    // Use this for initialization
    new protected void Start()
    {
        base.Start();
        // not sure where this came from...  but commented it out, after updating to ngui 2.3.6a

        // setting the local cached bot
        // Check make sure this is actually a BOT!
        myTempBot = MyTarget.GetComponent <Bot>();

        if (myTempBot != null)
        {
            // tell the bot that I am tracking you
            myTempBot.BotNotificationHUB = this;
        }

        //maxHeat = Slider.fullSize.x;
        //maxHeat = Slider.foreground.localScale.y;

        maxHeat = Slider.fullSize.y;


        highTemp.alpha = 0.0f;
        lowTemp.alpha  = 0.0f;
        curTemp.alpha  = 0.0f;
        Pointer.alpha  = 0.0f;

        highTemp.text = myTempBot.MaxTemperature.ToString();
        lowTemp.text  = myTempBot.MinTemperature.ToString();


        //Disable the label on start.
        WarningAnimation.Play(false);
        //ThermometerAnimation.Play(false);

        temp = false;

        //Animal.alpha = 0.0f;
        Animal.enabled = false;
    }
Ejemplo n.º 8
0
    public void TriggerTitleAnimation()
    {
        //Enable the object and play the animation.
        TitleAnimation.gameObject.SetActive(true);


        CurtainLeft.Reset();
        CurtainRight.Reset();
        curtainsDrawn = false;

        TitleAnimation.Reset();
        TitleAnimation.Play(true);

        AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotPushed);
    }
    public bool PlayCounterReset()
    {
        if (hasUIPanel)
        {
            //CounterResetNotificationUIPanel.enabled = true;
            CounterResetNotificationUIPanel.alpha = AlphaVisible;
        }


        if (hasanimation)
        {
            CounterResetNotificationAnimation.Reset();
            CounterResetNotificationAnimation.Play(true);
        }
        return(true);
    }
    // Update is called once per frame
    void LateUpdate()
    {
        if (MyTarget == null)
        {
            // if I dont have a target, remove me from the scene
            GameObject.Destroy(this.gameObject);
            return;
        }
        // make sure to follow the target
        transform.localPosition = MyTarget.transform.position;
        if (myTempBot == null)
        {
            Debug.LogError("HeatbarObject: Target host, is not a Bot object");
            return;
        }
        curHeat = myTempBot.Temperature;

        if (curHeat > maxHeat)
        {
            curHeat = maxHeat;
        }
        if (curHeat <= 0)
        {
            curHeat = 0.0009f;
        }


        Vector3 heatscale = new Vector3(Slider.foreground.localScale.x, curHeat, Slider.foreground.localScale.z);

        //Slider.foreground.localScale = heatscale;
        Slider.sliderValue = myTempBot.HeatPercent;


        //Play the cannon animation if we attached a cannon.
        if (myTempBot.VisibleTemp && !botcannon)
        {
            TheometerWindowPanel.alpha = 1.0f;

            //Set image.
            Animal.spriteName = myTempBot.GetCannon().CannonTextureName;

            //Play animation and set bool
            Animal.enabled = true;
            //Animal.alpha = 1.0f;
            AnimalAnimation.Reset();
            AnimalAnimation.Play(true);

            AnimalAlphaA.Reset();
            AnimalAlphaA.Play(true);

            botcannon = true;

            ThermometerAnimation.Reset();
        }

        if (!myTempBot.VisibleTemp)
        {
            botcannon      = false;
            Animal.enabled = false;
            // no cannon attached, pulling away the thermometer

//			WarningAnimation.Reset();
//			WarningAnimation.Play(false);
            WarningIcon.spriteName = NeedCannonSprite;
            QuestionMark.alpha     = 1.0f;

            highTemp.alpha = 0.0f;
            lowTemp.alpha  = 0.0f;
            curTemp.alpha  = 0.0f;
            Pointer.alpha  = 0.0f;
            ThermometerAnimation.Play(false);

            TheometerWindowPanel.alpha = 0.0f;
            //			temp  = false;
        }
        else
        {
            WarningIcon.alpha      = 0.0f;
            WarningIcon.spriteName = WarningSprite;
            QuestionMark.alpha     = 0.0f;
        }


        //Set the labels if we are shielded.
        if (myTempBot.IsShieldActive() || myTempBot.Warning)
        {
            //Turn on
            highTemp.alpha = 1.0f;
            lowTemp.alpha  = 1.0f;
            curTemp.alpha  = 1.0f;
            Pointer.alpha  = 1.0f;


            //Update variables.
            curTemp.text = myTempBot.CurrentTemp.ToString();

            Vector3 pos = Vector3.zero;
            pos.y = myTempBot.HeatPercent;

            //curTemp.transform.localPosition = pos;
            Current.localPosition = pos;

            ThermometerAnimation.Play(true);

            SetHeatLampIntensity(8);
            SetHeatLampRange(15);
        }
        else
        {
            highTemp.alpha = 0.0f;
            lowTemp.alpha  = 0.0f;
            curTemp.alpha  = 0.0f;
            Pointer.alpha  = 0.0f;
            ThermometerAnimation.Play(false);

            SetHeatLampIntensity(1);
            SetHeatLampRange(10);
        }



        //Handle warning info
        if (!myTempBot.Warning)
        {
            //WarningAnimation.Reset();
            WarningAnimation.Play(false);
            WarningLabel.alpha = 0.0f;
            temp = false;
            //WarningLabel.gameObject.SetActive(false);
        }


        if (!temp && myTempBot.Warning)
        {
            //WarningLabel.gameObject.SetActive(true);

            //WarningAnimation.Reset();
            WarningAnimation.Play(true);
            WarningLabel.alpha = 1.0f;
            temp = true;
        }
    }
    void OnClick()
    {
        //Distance must be bigger than the range to trigger a pause.
        if (!isPaused)
        {
            if (Distance < Range && !hack)
            {
                return;
            }
        }



        isInGame = !isInGame;
        isPaused = !isPaused;



        if (windowTransform != null)
        {
            windowTransform.Play(!isPaused);
        }


        //Set the pause time
        ToyBox.GetPandora().TimePaused = isPaused;

        if (isPaused)
        {
            /*
             * We can enable the activities and prep them for the main menu
             */
            //_invActivity.ActivityOn();


            AssignPausePosition();

            InGameScreen.TogglePanel(false);             //.TogglePanelFade();
            //ActivityManager.Instance.PullCurtain();

            ActivityManager.Instance.PushActivity(ActivityManager.ManagerActivities.Pause, true);

            //Play audio sound
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Pause);
        }
        else
        {
            /*
             * Make sure all activities are closed
             */
            //_invActivity.ActivityOff();
            InGameScreen.TogglePanel(true);             //.TogglePanelFade();


            //Clear everything when unpause!! //No !
            ActivityManager.Instance.ClearActivities();

            //Open Says Me
            //ActivityManager.Instance.DrawCurtain();
//			ActivityManager.Instance.TriggerTitleAnimation();

            //No! lol
            //ActivityManager.Instance.PopActivity();
        }
    }
Ejemplo n.º 12
0
    // Update is called once per frame
    void Update()
    {
        points = GameObjectTracker.GetGOT().GetCurrentPoints();

        //Trigger point adding animation.
        if (points > prevPoints)
        {
            //myLabelText = "" + points + "";
            myLabelText  = string.Format("{0:#,#,#}", points);
            myLabel.text = myLabelText;

            //Set the label of the point to add.
            //Lets set the label to the difference between prev point and current... uhh yeah.
            int dif = points - prevPoints;
            PointsAdd.text    = "+ " + dif.ToString();
            PointsAdd.alpha   = 1.0f;
            PointsAddBG.alpha = 1.0f;

            //Trigger animation.
            PointsAddAnimation.Reset();
            PointsAddAnimation.Play(true);

            prevPoints = points;
        }

        //Trigger point subtraction here.
        if (points < prevPoints)
        {
            //myLabelText = "" + points + "";
            myLabelText  = string.Format("{0:#,#,#}", points);
            myLabel.text = myLabelText;

            //Create the label as the difference between the points
            int dif = prevPoints - points;
            PointsSubtract.text = "- " + dif.ToString();
            //PointsSubtract.alpha = 1.0f;

            //Trigger animation.
            PointsSubtractAnimation.Reset();
            PointsSubtractAnimation.Play(true);

            PointsSubtractAlphaAnimation.Reset();
            PointsSubtractAlphaAnimation.Play(true);

            prevPoints = points;
        }

        if (points == 0)
        {
            myLabel.text = "0";
            prevPoints   = 0;
        }



        int newGems = GameObjectTracker.instance.GetGemsCollected();

        //Apply gems label here to draw it anyway.

        if (newGems > prevGemCount)
        {
            //Set the bank amount.
            float gemcount = (float)newGems;
            gemcount = gemcount / 100.0f;
            string gemFormat = string.Format("{0:C}", gemcount);
            Bank.text = gemFormat;


            //Get the multiplier to set as the adding amount
            int   multiplier = GameObjectTracker.instance.GetMultiplier();
            float addrate    = (float)multiplier;
            addrate = addrate / 100.0f;
            string addFormat = string.Format("{0:C}", addrate);
            BankAdd.text = addFormat;

            //Make visible the count label
            BankAdd.alpha = 1.0f;

            //Trigger Animation
            BankAddAnimation.Reset();
            BankAddAnimation.Play(true);

            prevGemCount = newGems;
        }


        if (newGems == 0)
        {
            //Draw gems at 0 here. only called when gems are 0.
            //Set the bank amount.
            float gemcount = (float)newGems;
            gemcount = gemcount / 100.0f;
            string gemFormat = string.Format("{0:C}", gemcount);
            Bank.text = gemFormat;

            prevGemCount = 0;
        }
    }
Ejemplo n.º 13
0
//	public void ButtonOpenCannonListPressed(){
//
//		// when the slot is clicked, and we know the slot is available to change.
//		// tell the activity to open up the cannon grid to select the cannon.
//		// The slot is not told that the button to select cannon has been clicked
//		// Two different scripts
//		if (_myActivity != null){
//			_myActivity.StartCannonSelect(this);
//		}
//	}

    public void ButtonCannonSelectedPressed(BaseItemCard ForcedCard = null)
    {
        BaseItemCard cannonItemCard = ActivityManager.Instance.HighlitedCard;

        //Lets check if there is no selected item
        if (cannonItemCard == null)
        {
            //Turn off the info window.
            //SlotInfo.ToggleWindowOff();

            //Play sound.
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.Select);

            //If we press the button and we have no cannon then we clear the slot.
            if (_myslot.Type != EntityFactory.CannonTypes.NULL)
            {
                //Clear slot if pressed with nothign selected.
                _myslot.Type = EntityFactory.CannonTypes.NULL;

                //Play the clear animation
                DeSelectAnimation.Reset();
                DeSelectAnimation.Play(true);


                //Set to zebra as default.
                if (_myslot.StartActive)
                {
                    _myslot.Type      = EntityFactory.CannonTypes.Zebra;
                    _lblSlotName.text = "Default";
                }


                ToyBox.GetPandora().AssignSlot(_myslot.Type, _slotIndex);

                //Since we cleared the slow, play the cleared slot label.
                _lblSlotName.text = EmptySlotLabel;

                //Update teh costs here.
                GameObjectTracker.instance._PlayerData.GemCart -= _slotitemCost;
                _slotitemCost = 0;

                // then update the slot visuals
                UpdateDisplay();
                return;
            }

            MinusSlot();
//			Debug.LogError("Slot Minused");
            return;
        }



        // the cannon isn't used, assign it
        ToyBox.GetPandora().AssignSlot(cannonItemCard.ContainedCannonType, _slotIndex);

        // then update the slot visuals
        _sprIcon.spriteName = cannonItemCard.DisplayInfo.IconName;
        _lblSlotName.text   = cannonItemCard.Label;

        //Check here if slot is 0 then apply cost. or it would apply cost every time we tap.
        if (_slotitemCost != cannonItemCard.DisplayInfo.GemRequirements)
        {
            //Negate the current item cost count before we update.
            GameObjectTracker.instance._PlayerData.GemCart -= _slotitemCost;

            //Set the cost.
            _slotitemCost = cannonItemCard.DisplayInfo.GemRequirements;
            GameObjectTracker.instance._PlayerData.GemCart += _slotitemCost;
        }

        //Play the animation
        if (SelectTween)
        {
            SelectTween.Reset();
            SelectTween.Play(true);

            //Play audio sound
            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotPushed);

            AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect);
        }
    }
 void EndTouch()
 {
     EndTouchAnimation.Reset();
     EndTouchAnimation.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;
    }