Exemple #1
0
    private IEnumerator FailCoroutine(FailCondition failCondition)
    {
        Debug.Log("FAIL : " + failCondition.failType);

        if (failCondition.failureIncludesExplosion)
        {
            m_explosionAudioSource.transform.position = failCondition.failurePosition;
            m_explosionAudioSource.Play();

            m_explosionParticuleSystem.transform.position = failCondition.failurePosition;
            m_explosionParticuleSystem.Play();

            if (failCondition.failType == FailCondition.FailType.EthoxyethaneExplosion)
            {
                m_ethoxyethaneMeshExplosion.Explode(failCondition.failurePosition);
            }

            yield return(new WaitForSeconds(m_explosionAudioSource.clip.length + 0.25f));
        }

        if (failCondition.failType == FailCondition.FailType.BrokenGlass)
        {
            yield return(new WaitForSeconds(2));
        }

        Instructor.PlayFailSound();

        yield return(new WaitForSeconds(2));

        XperManager.SaveEntries();
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
Exemple #2
0
    static public void ProvokeFail(FailCondition failCondition, GameObject source)
    {
        if (s_singleton.m_failed)
        {
            return;
        }

        s_singleton.StartCoroutine(s_singleton.FailCoroutine(failCondition));

        if (failCondition.failureIncludesExplosion)
        {
            MeshExplosion meshExplosion = source.GetComponent <MeshExplosion>();
            if (meshExplosion)
            {
                meshExplosion.Explode(source.transform.position);
            }
        }
    }
Exemple #3
0
    private void OnTriggerEnter(Collider other)
    {
        Match match = other.GetComponent <Match>();

        if (match && match.isLighted && ContainsEnoughEthanolToReactToFire())
        {
            if (CanExplode())
            {
                FailCondition fail = new FailCondition(FailCondition.FailType.EthanolExplosion);
                fail.failureIncludesExplosion = true;
                fail.failurePosition          = transform.position;
                Watcher.ProvokeFail(fail, transform.parent.gameObject);
                m_meshExplosion.Explode(transform.position);
            }
            else if (!m_fluwidManager.burning)
            {
                m_fluwidManager.BurnEthanol();
            }
        }
    }