コード例 #1
0
    void FixedUpdate()
    {
        //If player is picking the trash up
        if (timerOn)
        {
            timer.Time += Time.deltaTime;

            //If enough time has passed while interacting with player, pick it up
            if (timer.Expired == true)
            {
                //plays the sound
                audioSource.clip = audioClip;
                audioSource.Play();

                //plays the animation
                if (gameObject.tag == "Spraybottle")
                {
                    playerAnim.PickedUpSpray();
                }

                else if (gameObject.tag == "Trashbag")
                {
                    playerAnim.PickedUpBag();
                }

                //If it should damage a boss, and there actually is a boss, damage it
                if (activateHealthBar && trudgesHealthBar != null)
                {
                    trudgesHealthBar.UpdateBar();
                }

                //Fills the powerup meter
                pointSystem.FillMeter(fillMeterWith);

                //Destroy pickup
                Destroy(gameObject);
            }
        }
    }