Example #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);
    }
Example #2
0
    private bool CheckCupFluwidManager(out FailCondition failCondition)
    {
        failCondition        = new FailCondition(FailCondition.FailType.WetCup);
        failCondition.failed = m_cupFluwidManager.currentVolume >= (m_cupFluwidManager.fullVolume / 10);

        return(failCondition.failed);
    }
Example #3
0
    private bool CheckEthoxethane(out FailCondition failCondition)
    {
        failCondition        = new FailCondition(FailCondition.FailType.EthoxyethaneExplosion);
        failCondition.failed = !m_ethoxyethane.flowBlocked;

        if (failCondition.failed)
        {
            failCondition.failureIncludesExplosion = true;
            failCondition.failurePosition          = m_ethoxyethane.GetTopCenterWorldPosition();
        }

        return(failCondition.failed);
    }
Example #4
0
 public void ParseFailConditions(XmlNode node)
 {
     foreach (XmlNode pNode in node.ChildNodes)
     {
         switch (pNode.Name)
         {
         case "type_list":
             foreach (XmlNode type in pNode.SelectNodes("type"))
             {
                 FailConditions |= type.ReadValueEnum <FailCondition>();
             }
             break;
         }
     }
 }
Example #5
0
        async Task OnMessageReceived(IMessage message)
        {
            if (Delay > TimeSpan.Zero)
            {
                await Task.Delay(Delay);
            }

            ReceivedMessages.Add(message);

            if (!(message is ISilverbackEvent) &&
                MustFailCount > FailCount || (FailCondition?.Invoke(message) ?? false))
            {
                FailCount++;
                throw new Exception("Test failure");
            }
        }
Example #6
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);
            }
        }
    }
    private void OnCollisionEnter(Collision other)
    {
        if ((other.collider.isTrigger) || (other.collider.gameObject.name == "VitreHotte"))
        {
            return;
        }

        ViveCork otherCork = other.gameObject.GetComponent <ViveCork>();

        if (otherCork)
        {
            return;
        }
        VivePickable otherPickable = other.gameObject.GetComponent <VivePickable>();

        float collisionForce = other.relativeVelocity.magnitude * other.relativeVelocity.magnitude;

        if (other.rigidbody)
        {
            collisionForce *= other.rigidbody.mass;
        }
        else
        {
            collisionForce *= m_rigidbody.mass;
        }
        bool conditionsToExplode = (collisionForce >= 3) && !(m_pickable && m_pickable.picked) && !(otherPickable && otherPickable.picked);

        if (conditionsToExplode)
        {
            MakeGlassBreakSound();

            FailCondition failCondition = new FailCondition(FailCondition.FailType.BrokenGlass);
            failCondition.failed          = true;
            failCondition.failurePosition = transform.position;
            Watcher.ProvokeFail(failCondition, gameObject);

            Debug.Log("ColliXion avec " + other.collider.name + "(Force : " + Mathf.Round(collisionForce * 10) / 10 + " )");
            Explode(other.contacts[0].point);
        }
        else
        {
            MakeGlassShockSound(other.contacts[0].point, other.relativeVelocity.magnitude);
        }
    }
Example #8
0
    private bool CheckFluwidsQuantities(out FailCondition failCondition)
    {
        failCondition = new FailCondition(FailCondition.FailType.NoMoreReagents);

        if (m_mercuryThiocyanateStack.stackSize > 0.1f)
        {
            return(false);
        }

        float reagentsQuantity = 0;

        float hydrogenNitrate = 0;
        float mercury         = 0;
        float mercuryNitrate  = 0;
        float potassium       = 0;

        foreach (SmartFluwid fluwidManager in m_allFluwidManagers)
        {
            if (fluwidManager.stackSize > 0.1f)
            {
                return(false);
            }

            Compound compound = fluwidManager.compound;

            hydrogenNitrate += compound.ElementQuantity(Compound.Elements.HydrogenNitrate);
            mercury         += compound.ElementQuantity(Compound.Elements.ElementalMercury) * 50;
            mercuryNitrate  += compound.ElementQuantity(Compound.Elements.MercuryNitrate);
            potassium       += compound.ElementQuantity(Compound.Elements.PotassiumThiocyanate);

            reagentsQuantity += compound.ElementQuantity(Compound.Elements.MercuryThiocyanate);
        }

        float mercuryNitrateDoable     = Mathf.Min(hydrogenNitrate, mercury);
        float mercuryThiocyanateDoable = Mathf.Min(mercuryNitrate + mercuryNitrateDoable, potassium);

        reagentsQuantity += mercuryThiocyanateDoable;


        failCondition.failed = reagentsQuantity <= 0;

        return(failCondition.failed);
    }
Example #9
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();
            }
        }
    }
        public static void FailConditionInspectorGUI(FailCondition fail)
        {
            fail.Condition = EditorGUILayout.MaskField("失败条件", fail.Condition, System.Enum.GetNames(typeof(EnumFailCondition)));

            EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(Screen.width - 16));
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical();

            if (EnumTables.MaskFieldIdentify(fail.Condition, (int)EnumFailCondition.人物死亡))
            {
                fail.PlayerID = EditorGUILayout.IntField("人物 ID", fail.PlayerID);
            }
            if (EnumTables.MaskFieldIdentify(fail.Condition, (int)EnumFailCondition.城池被夺))
            {
                fail.CityID = EditorGUILayout.IntField("城池 ID", fail.CityID);
            }
            if (EnumTables.MaskFieldIdentify(fail.Condition, (int)EnumFailCondition.回合达到))
            {
                fail.Round = EditorGUILayout.IntField("回合数", fail.Round);
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }