Ejemplo n.º 1
0
    private void OnSicknessTrigger(GameObject target, TriggerInfo trigger)
    {
        int      num      = UnityEngine.Random.Range(0, trigger.sickness_ids.Length);
        string   text     = trigger.sickness_ids[num];
        Sickness sickness = null;

        Database.Sicknesses sicknesses = Db.Get().Sicknesses;
        for (int i = 0; i < sicknesses.Count; i++)
        {
            if (sicknesses[i].Id == text)
            {
                sickness = sicknesses[i];
                break;
            }
        }
        if (sickness != null)
        {
            string infection_source_info       = trigger.sourceCallback(base.gameObject, target);
            SicknessExposureInfo exposure_info = new SicknessExposureInfo(sickness.Id, infection_source_info);
            Klei.AI.Sicknesses   sicknesses2   = target.GetComponent <MinionModifiers>().sicknesses;
            sicknesses2.Infect(exposure_info);
        }
        else
        {
            DebugUtil.DevLogErrorFormat(base.gameObject, "Couldn't find sickness with id [{0}]", text);
        }
    }
Ejemplo n.º 2
0
        protected override void OnPrefabInit()
        {
            base.OnPrefabInit();
            amounts    = new Amounts(base.gameObject);
            sicknesses = new Sicknesses(base.gameObject);
            attributes = new Attributes(base.gameObject);
            foreach (string initialAmount in initialAmounts)
            {
                amounts.Add(new AmountInstance(Db.Get().Amounts.Get(initialAmount), base.gameObject));
            }
            Traits component = GetComponent <Traits>();

            if (initialTraits != null)
            {
                string[] array = initialTraits;
                foreach (string id in array)
                {
                    Trait trait = Db.Get().traits.Get(id);
                    component.Add(trait);
                }
            }
        }