Beispiel #1
0
    public void PlayTween(int type)
    {
        if (type == 1)
        {
            tweens.DOPlayById("1");
        }
        else if (type == 2)
        {
            tweens.DOPlayById("2");
        }
        else
        {
            tweens.DOPlayById("3");
        }

//			GetComponents<DOTweenAnimation> () [0].DOPlayForward ();
//		else
//			GetComponents<DOTweenAnimation> () [1].DOPlayForward ();
    }
Beispiel #2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "HitBox")
     {
         if (_chestOpened == false)
         {
             StartCoroutine("OpenChest", Random.Range(5, 11));
             openAnim.DOPlayById("OPEN");
             _chestOpened = true;
         }
     }
 }
    void Damage()
    {
        //On damage do particle effects and play sound do animation
        BarController barcontroller = GameObject.Find("Captain").GetComponent <BarController>();

        if (barcontroller.GetPick() == true)
        {
            damage = 2;
        }
        health -= damage;
        damage  = 1;
        shakeAnim.DOPlayById("SHAKE");
        audioS.PlayOneShot(damage_sound, 1f);
        Instantiate(particleBits, this.gameObject.transform.position, Quaternion.Euler(270, 45, 0));
    }
        static public IObservable <DOTweenAnimation> DOPlayByIdAsObservable(
            this DOTweenAnimation animation,
            string id,
            bool rewind = false)
        {
            return(Observable.Create <DOTweenAnimation>(o =>
            {
                if (rewind)
                {
                    animation.DORewind();
                }

                animation.tween.OnComplete(() =>
                {
                    o.OnNext(animation);
                    o.OnCompleted();
                });
                animation.DOPlayById(id);
                return Disposable.Empty;
            }));
        }
Beispiel #5
0
 // Start is called before the first frame update
 void Start()
 {
     dt = this.GetComponent <DOTweenAnimation>();
     dt.DOPlayById("");
 }
    // Update is called once per frame
    void Update()
    {
        damageTaken = barScript.damageDone;

        #region Check if Dead
        if (health <= 0)
        {
            if (!_isBoss)
            {
                doDamageScript.enabled = false;
            }
            if (_isDead == false)
            {
                if (!_isBoss)
                {
                    barScript.SetScore(barScript.GetScore() + Random.Range(2, 7));
                    deathAnim.DOPlayById("DEATH");
                    float pickReward = Random.value;
                    if (pickReward >= 0.1f)
                    {
                        Loot(0);

                        if (barScript.GetGoldTooth() == true)
                        {
                            Loot(0);
                        }
                    }
                    else
                    {
                        Loot(1);
                    }
                }
                else
                {
                    barScript.SetScore(barScript.GetScore() + 10);
                    Loot(2);
                }

                //If boss do instant death timer else apply 2 seconds of death time
                if (_isBoss)
                {
                    StartCoroutine("DeathTimer", 0f);
                }
                else
                {
                    StartCoroutine("DeathTimer", 1.5f);
                }
                //audioS.PlayOneShot(deathSound, 1.0F);
                _isDead = true;
            }
        }
        #endregion

        #region Flash when enemy is hit
        if (flashTime > 0)
        {
            flashTime -= Time.deltaTime;
            flash.SetActive(true);
        }
        else if (flashTime <= 0)
        {
            flashTime = 0;
            flash.SetActive(false);
        }
        #endregion
    }
Beispiel #7
0
 private void UIAnimChange(DOTweenAnimation tweenComponent)
 {
     tweenComponent.DORestartById("Shake");
     tweenComponent.DOPlayById("Shake");
 }
Beispiel #8
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();
    }