public virtual bool Infect(object sender, InfectionEventArgs args) { // This should be made more complex in the future. if (!(new List <TransmissionMediumType>(m_MediumImmunities)).Contains(args.TransmissionMedium)) { var infPrefab = args.InfectionPrefab.GetComponent <InfectionBase>(); if (infPrefab) { if (InfectionDict.ContainsKey(infPrefab.InfectionName)) { return(false); } var go = GameObject.Instantiate(args.InfectionPrefab, this.transform.position, this.transform.rotation, this.transform); var inf = go.GetComponent <InfectionBase>(); if (inf) { inf.Infect(this); this.Infections.Add(inf); this.InfectionDict.Add(inf.InfectionName, inf); OnInfect(sender, args); return(true); } } } return(false); }
private void SendOnInfect(object sender, InfectionEventArgs args) { if (m_PlayMaker) { Debug.Log("OnGetSick!"); // Make sure that this is the first infection. if (SubscribableObject.InfectionDict.Count == 1) { m_PlayMaker.SendEvent(OnInfectEventName); } } }