Пример #1
0
    public void OnSpawnInjuryClick(Dropdown e)
    {
        var injuryName = e.options[e.value].text?.Replace(" ", "");
        var bodyPart   = (ZaraEngine.Injuries.BodyParts)e.gameObject.transform.Find("BodyPart").GetComponent <Dropdown>().value;
        var injury     = new ZaraEngine.Injuries.ActiveInjury(this, Type.GetType($"ZaraEngine.Injuries.{injuryName}"), bodyPart, WorldTime.Value);

        _health.Status.ActiveInjuries.Add(injury);
    }
Пример #2
0
    public void OnSpawnDiseaseClick(Dropdown e)
    {
        var diseaseName = e.options[e.value].text?.Replace(" ", "");

        if (string.IsNullOrEmpty(diseaseName))
        {
            return;
        }

        var disease = Activator.CreateInstance(Type.GetType($"ZaraEngine.Diseases.{diseaseName}")) as ZaraEngine.Diseases.DiseaseDefinitionBase;

        if (disease == null)
        {
            return;
        }

        // Blood Poisoning requires a body part (from where blood poisoning has started) to be present. We'll do any body part, does not matter whitch one
        if (diseaseName == "BloodPoisoning")
        {
            var injuryThatCausedBloodPoisoning = new ZaraEngine.Injuries.ActiveInjury(this, Type.GetType("ZaraEngine.Injuries.DeepCut"), ZaraEngine.Injuries.BodyParts.RightForearm, WorldTime.Value);

            _health.Status.ActiveInjuries.Add(injuryThatCausedBloodPoisoning);
            _health.Status.ActiveDiseases.Add(new ZaraEngine.Diseases.ActiveDisease(this, disease, injuryThatCausedBloodPoisoning, WorldTime.Value));
        }
        else
        {
            // Venom Poisoning requires a body part (from where venom poisoning has started) to be present. We'll do any body part, does not matter whitch one
            if (diseaseName == "VenomPoisoning")
            {
                var injuryThatCausedVenomPoisoning = new ZaraEngine.Injuries.ActiveInjury(this, Type.GetType("ZaraEngine.Injuries.LightCut"), ZaraEngine.Injuries.BodyParts.LeftFoot, WorldTime.Value);

                _health.Status.ActiveInjuries.Add(injuryThatCausedVenomPoisoning);
                _health.Status.ActiveDiseases.Add(new ZaraEngine.Diseases.ActiveDisease(this, disease, injuryThatCausedVenomPoisoning, WorldTime.Value));
            }
            else
            {
                _health.Status.ActiveDiseases.Add(new ZaraEngine.Diseases.ActiveDisease(this, disease, WorldTime.Value));
            }
        }
    }