Esempio n. 1
0
        void ScaleAreaPanel()
        {
            SelectAreaPanelData sd       = GameData.Instance.SelectAreaPanelData;
            DOTweenAnimation    DoTwAnim = _gPanelBg.GetComponent <DOTweenAnimation>();
            Tweener             dt       = DoTwAnim.tween as Tweener;

            Debug.Log(sd.pos_index + "__" + _pos[sd.pos_index].localPosition);
            dt.ChangeEndValue(_pos[sd.pos_index].localPosition);
            CloseNeed();
            DoTwAnim.DORestartById("1");
            //  Debug.Log("动画前原来:" + _gPanelBg.transform.localScale);
            DoTwAnim.DORestartById("2");
            //dt.Restart();
            DoTwAnim.tween.OnComplete(() =>
            {
                //DoTwAnim.DORestartById("3");
                //  Debug.LogWarning("缩放完成");
                Ok();
            });
        }
Esempio n. 2
0
 static public IObservable <DOTweenAnimation> DORestartByIdAsObservable(
     this DOTweenAnimation animation,
     string id)
 {
     return(Observable.Create <DOTweenAnimation>(o =>
     {
         animation.tween.OnComplete(() =>
         {
             o.OnNext(animation);
             o.OnCompleted();
         });
         animation.DORestartById(id);
         return Disposable.Empty;
     }));
 }
Esempio n. 3
0
 private void UIAnimChange(DOTweenAnimation tweenComponent)
 {
     tweenComponent.DORestartById("Shake");
     tweenComponent.DOPlayById("Shake");
 }
Esempio n. 4
0
    //Update
    private void Fireplace_OnUpdateEvent()
    {
        float fuelLastUpdateTemp = fuelCurr;

        if (GameObject.FindGameObjectWithTag("GameLogic").GetComponent <GamePhases>().currentPhase != GamePhases.Phase.Start_1)
        {
            //if fire is burning
            if (fuelCurr > 0)
            {
                fuelCurr -= burnSpeed * Time.deltaTime;
            }
            else
            {
                fuelCurr = 0;
            }
        }

        //0%
        if ((fuelCurr <= 0) && !(fuelLastUpdate <= 0))
        {
            fireAnim.DOPause();

            fire.GetComponent <SpriteRenderer>().color = new Color(0f, 0f, 0, 1);

            pot.GetComponent <DOTweenAnimation>().DORewind();
            pot.GetComponent <DOTweenAnimation>().DOPause();

            sound.StopSound("PotCooking");
            sound.PlaySound("fireplaceRunOut");

            steamSettings.startColor = new Color(0.533f, 0.486f, 0.686f, 0f);

            OnReachingFuelTierEvent(0);
            fuelCurr = 0;
        }
        //if fire is at 10%
        if ((fuelCurr <= 10) && !(fuelLastUpdate <= 10))
        {
            fire.GetComponent <SpriteRenderer>().color = new Color(0.33f, 0.275f, 0, 1);

            steamSettings.startColor = new Color(0.533f, 0.486f, 0.686f, 0.25f);

            pot.GetComponent <DOTweenAnimation>().DORewind();
            pot.GetComponent <DOTweenAnimation>().DOPause();

            SoundManager.pot.volume = SoundManager.pot.volume / 2;

            fireAnim.DOPause();
            fireAnim.DORestartById("10");
            fireAnim.DOPlayById("10");

            OnReachingFuelTierEvent(10);
        }
        //50%
        if ((fuelCurr > 10 && fuelCurr <= 50) && !(fuelLastUpdate > 10 && fuelLastUpdate <= 50))
        {
            fire.GetComponent <SpriteRenderer>().color = new Color(0.831f, 0.761f, 0.416f, 1);

            steamSettings.startColor = new Color(0.533f, 0.486f, 0.686f, 0.5f);

            pot.GetComponent <DOTweenAnimation>().DORestartById("Boiling");
            pot.GetComponent <DOTweenAnimation>().DOPlayById("Boiling");

            sound.PlaySound("PotCooking");

            fireAnim.DOPause();
            fireAnim.DORestartById("50");
            fireAnim.DOPlayById("50");

            OnReachingFuelTierEvent(50);
        }
        if ((fuelCurr > 50 && fuelCurr < 100) && !(fuelLastUpdate > 50 && fuelLastUpdate < 100))
        {
            fire.GetComponent <SpriteRenderer>().color = new Color(1, 0.941f, 0.667f, 1);

            steamSettings.startColor = new Color(0.533f, 0.486f, 0.686f, 1);

            pot.GetComponent <DOTweenAnimation>().DORestartById("Boiling");
            pot.GetComponent <DOTweenAnimation>().DOPlayById("Boiling");

            sound.PlaySound("PotCooking");

            fireAnim.DOPause();
            fireAnim.DORestartById("100");
            fireAnim.DOPlayById("100");

            OnReachingFuelTierEvent(100);
        }

        fuelLastUpdate = fuelLastUpdateTemp;

        fuelStatus.GetComponent <Text>().text = Mathf.Floor((fuelCurr / fuelMax) * 100).ToString();
    }