Beispiel #1
0
        private IEnumerator TasteTest(Bottle bottle)
        {
            m_bottle.SetActive(true);
            m_animator.SetBool("NoBottle", false);
            bottle.gameObject.SetActive(false);
            bottle.transform.SetParent(null, true);

            ModBehaviour.buyerTaste.PlayClipThrough(m_audioSource);
            yield return(new WaitForSeconds(m_audioSource.clip.length));

            m_animator.Play("BuyerDrink");
            m_lookAtPlayer = false;
            yield return(new WaitForSeconds(1.9f));

            m_lookAtPlayer = true;

            var ethanolPercentage    = bottle.ethanol / bottle.total;
            var methanolPercentage   = bottle.methanol / bottle.total;
            var ethanolMethanolRatio = ethanolPercentage / (methanolPercentage + 0.000001f);

            if (bottle.total < 0.01f)
            {
                // empty
                StartCoroutine(Empty(bottle));
            }
            else if (ethanolPercentage < 0.3f)
            {
                // it's water
                StartCoroutine(Water(bottle));
            }
            else if (ethanolMethanolRatio < 20)
            {
                // too much methanol
                StartCoroutine(Methanol(bottle));
            }
            else
            {
                // it's good!
                StartCoroutine(Good(bottle));
            }
        }
Beispiel #2
0
        private IEnumerator Good(Bottle bottle)
        {
            ModBehaviour.buyerTasteGood.PlayClipThrough(m_audioSource);
            yield return(new WaitForSeconds(m_audioSource.clip.length));

            yield return(new WaitForSeconds(1f));

            m_animator.SetBool("TookMoney", false);
            m_animator.Play("BuyerBottleBuy");
            ModBehaviour.buyerPayment.PlayClipThrough(m_audioSource);

            yield return(new WaitForSeconds(0.5f));

            // show the money
            m_money.SetActive(true);

            var ethanolPercentage = bottle.ethanol / bottle.total;
            var money             = Mathf.Floor(ethanolPercentage * bottle.total * 120) * 10;

            if (float.IsNaN(money))
            {
                money = 0;
            }

            while (true)
            {
                var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                var hit = Physics.RaycastAll(ray, 1f).Any(x => x.collider == m_moneyTakeTrigger);
                if (hit)
                {
                    m_guiInteraction.Value = "Take " + money + " mk";
                    m_guiUse.Value         = true;

                    if (Input.GetMouseButtonDown(0))
                    {
                        break;
                    }
                }
                yield return(null);
            }

            m_money.SetActive(false);
            m_animator.SetBool("TookMoney", true);
            PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerMoney").Value += money;

            bottle.transform.position = new Vector3(-12.10657f, -0.293821f, 9.283916f);
            bottle.gameObject.SetActive(true);
            bottle.ethanol  = 0;
            bottle.water    = 0;
            bottle.methanol = 0;

            ModBehaviour.buyerBottleReturn.PlayClipThrough(m_audioSource);
            yield return(new WaitForSeconds(m_audioSource.clip.length));

            yield return(new WaitForSeconds(2f));

            if (Random.value < 0.3f)
            {
                ModBehaviour.buyerStory.PlayClipThrough(m_audioSource);
                yield return(new WaitForSeconds(m_audioSource.clip.length));

                yield return(new WaitForSeconds(2f));
            }

            ModBehaviour.buyerByeBye.PlayClipThrough(m_audioSource);
        }