Ejemplo n.º 1
0
    void OnTriggerEnter(Collider other)
    {
        FluidHolderScript holder = other.GetComponent <FluidHolderScript>();

        if (holder != null)
        {
            if (holder != creator)
            {
                other.GetComponent <FluidHolderScript>().addToSolution(solutionToAdd);
                Destroy(this.gameObject);
            }
        }

        else if (!other.GetComponent <Collider>().isTrigger)
        {
            Destroy(this.gameObject);
        }
    }
    void OnTriggerStay(Collider other)
    {
        if (other.gameObject.GetComponent <FluidHolderScript>())
        {
            FluidHolderScript fluid = other.gameObject.GetComponent <FluidHolderScript>();
            fluid.solution.temperature += (bunsen.startSpeed * heatRate);

            if (fluid.solution.temperature > 200)
            {
                fluid.solution.temperature = 200;
            }

            if (fluid.solution.getAmount() >= fluid.maxAmount / 4 && fluid.solution.temperature > 100)
            {
                Debug.Log("BOILING");
                if (!boilCoroutine)
                {
                    StartCoroutine(BoilWater(other));
                }
            }
        }

        else if (other.gameObject.GetComponent <SteelFire>())
        {
            if (bunsen.startSpeed >= 5)
            {
                if (!audioPlayed)
                {
                    audio.clip = steelAudio;
                    audio.Play();
                    audioPlayed = true;
                }
                other.gameObject.GetComponent <SteelFire>().Explode();
            }
        }

        else if (other.tag == "Paper")
        {
            if (!paperCoroutine)
            {
                StartCoroutine(BurnPaper(other));
            }
        }
    }