Ejemplo n.º 1
0
 public override void Update(CharacterHealth characterHealth, Limb targetLimb, float deltaTime)
 {
     base.Update(characterHealth, targetLimb, deltaTime);
     character = characterHealth.Character;
     if (character == null)
     {
         return;
     }
     if (!subscribedToDeathEvent)
     {
         character.OnDeath     += CharacterDead;
         subscribedToDeathEvent = true;
     }
     if (Strength < DormantThreshold)
     {
         DeactivateHusk();
         if (Strength > Math.Min(1.0f, DormantThreshold))
         {
             State = InfectionState.Dormant;
         }
     }
     else if (Strength < ActiveThreshold)
     {
         DeactivateHusk();
         if (Prefab is AfflictionPrefabHusk {
             CauseSpeechImpediment : true
         })
Ejemplo n.º 2
0
 public CoreBase(string name, GameFolder parent, InfectionState infectionState, ScanResult result)
 {
     Name             = name;
     ContainingFolder = parent;
     InfectionState   = infectionState;
     Result           = result;
 }
Ejemplo n.º 3
0
 public void Infect()
 {
     if (infectionState == InfectionState.Healthy)
     {
         infectionState = InfectionState.InitialInfection;
         numInfected++;
     }
 }
    private void BecomeInfectedWith(int infectionType)
    {
//		Debug.Log ("Infected with cat " + infectionType);
        AudioSource.PlayClipAtPoint(miaows [Random.Range(0, miaows.Length)], Vector3.zero);
        meshRenderer.material = zoneMats[infectionType];
        infectionState        = (InfectionState)infectionType;
        infectionTimer        = infectionTimerReset;
    }
Ejemplo n.º 5
0
 public static bool HasInfectionState(Pawn pawn, InfectionState minState, InfectionState maxState)
 {
     return(pawn.health.hediffSet
            .GetHediffs <Hediff_Injury_ZombieBite>()
            .SelectMany(hediff => hediff.comps)
            .OfType <HediffComp_Zombie_TendDuration>()
            .Any(tendDuration => tendDuration.InfectionStateBetween(minState, maxState)));
 }
Ejemplo n.º 6
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            if (state != InfectionState.Dormant)
            {
                DeactivateHusk(character);
            }

            state = InfectionState.Dormant;
        }
Ejemplo n.º 7
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            if (state != InfectionState.Transition)
            {
                DeactivateHusk(character);
            }

            state = InfectionState.Transition;
        }
Ejemplo n.º 8
0
    public void MakeInfected()
    {
        infectionState        = InfectionState.Infected;
        spriteRenderer.sprite = infectedPersonSprite;
        infectedTime          = Time.timeSinceLevelLoad;

        // Let's not infect immediately
        lastInfection = Time.timeSinceLevelLoad + infectionCooldown;
    }
Ejemplo n.º 9
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            if (state != InfectionState.Transition)
            {
                DeactivateHusk(character);
            }

            IncubationTimer += deltaTime / IncubationDuration;
            state            = InfectionState.Transition;
        }
Ejemplo n.º 10
0
        private void UpdateActiveState(float deltaTime, Character character)
        {
            if (state != InfectionState.Active)
            {
                ActivateHusk(character);
                state = InfectionState.Active;
            }

            character.AddDamage(CauseOfDeath.Husk, 0.5f * deltaTime, null);
        }
Ejemplo n.º 11
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            IncubationTimer += deltaTime / IncubationDuration;

            if (state == InfectionState.Dormant && Character.Controlled == character)
            {
                new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
            }

            state = InfectionState.Transition;
        }
Ejemplo n.º 12
0
        private void UpdateActiveState(float deltaTime, Character character)
        {
            if (state != InfectionState.Active)
            {
                ActivateHusk(character);
                state = InfectionState.Active;
            }

            character.AddDamage(CauseOfDeath.Husk, GameMain.NilMod.PlayerHuskIncurableDrain * deltaTime, null, "Husk Infection");
            //character.AddDamage(CauseOfDeath.Husk, 0.5f * deltaTime, null);
        }
 private void Infect(Infectable target, InfectionState state, bool addToMap)
 {
     if (logInfections)
     {
         DebugHelper.Log(Color.red, "Infected {0}".Format(target.name));
     }
     target.infectionState = state;
     if (addToMap)
     {
         AddInfectionMap(target.transform.position);
     }
 }
Ejemplo n.º 14
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            if (state != InfectionState.Dormant)
            {
                DeactivateHusk(character);
            }

            float prevTimer = IncubationTimer;

            state            = InfectionState.Dormant;
            IncubationTimer += deltaTime / IncubationDuration;
        }
    private void CleanUp()
    {
        infectionTimer -= Time.deltaTime;

        if (infectionTimer <= 0)
        {
//			Debug.Log ("Is clean!");
            meshRenderer.material = zoneMats[0];
            infectionState        = InfectionState.Clean;
            infectionTimer        = infectionTimerReset;
        }
    }
Ejemplo n.º 16
0
        public void IterateState()
        {
            int newState = (int)State;

            newState++;
            if (newState > 3)
            {
                newState -= 4;
            }

            State = (InfectionState)newState;
        }
Ejemplo n.º 17
0
 public void Quarantine(float time, GameManager gManager)
 {
     manager = gManager;
     if (CoreElement.InfectionState != InfectionState.Quarantined)
     {
         prevState = CoreElement.InfectionState;
     }
     CoreElement.InfectionState = InfectionState.Quarantined;
     quarantineTime             = time;
     elapsedQTime = 0f;
     GetComponent <TextMeshProUGUI>().color = Color.cyan;
 }
Ejemplo n.º 18
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            float prevTimer = IncubationTimer;

            state = InfectionState.Dormant;

            IncubationTimer += deltaTime / IncubationDuration;

            if (Character.Controlled != character)
            {
                return;
            }
        }
Ejemplo n.º 19
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            if (state != InfectionState.Transition)
            {
                DeactivateHusk(character);
            }

            IncubationTimer += deltaTime / IncubationDuration;

            character.AddDamage(CauseOfDeath.Husk, GameMain.NilMod.PlayerHuskInfectedDrain * deltaTime, null, "Husk Infection");

            state = InfectionState.Transition;
        }
Ejemplo n.º 20
0
        public static bool HasInfectionState(Pawn pawn, InfectionState state)
        {
            if (pawn.RaceProps.Humanlike == false)
            {
                return(false);
            }

            return(pawn.health.hediffSet
                   .GetHediffs <Hediff_Injury_ZombieBite>()
                   .SelectMany(hediff => hediff.comps)
                   .OfType <HediffComp_Zombie_TendDuration>()
                   .Any(tendDuration => tendDuration.GetInfectionState() == state));
        }
Ejemplo n.º 21
0
 private void BecomeInfectedWith(int infectionType)
 {
     // Debug.Log ("Is cat " + infectionType);
     if (bodyMats.Length > 0)
     {
         meshRenderer.material = bodyMats[infectionType];
     }
     else
     {
         Debug.LogWarning("No materials in the bodyMats array!");
     }
     infectionState = (InfectionState)infectionType;
 }
Ejemplo n.º 22
0
    IEnumerator ProcessInfectionState()
    {
        float incubatingTime        = Random.Range(kIncubatingTimeRange.x, kIncubatingTimeRange.y);
        float asymptomaticTime      = Random.Range(kAsymptomaticTimeRange.x, kAsymptomaticTimeRange.y);
        bool  willShowSymptoms      = Random.value < kChanceWillShowSymptoms;
        float symptomaticTime       = Random.Range(kSyptomaticTimeRange.x, kSyptomaticTimeRange.y);
        bool  willGoCritical        = Random.value < kChanceWillGoCritical;
        float criticalTime          = Random.Range(kCriticaltimeRange.x, kCriticaltimeRange.y);
        bool  willDie               = Random.value < kChanceWillDie;
        bool  willDieWithoutSupport = Random.value < kChanceWillDieWithoutSupport;

        infectionState = InfectionState.Incubating;
        yield return(new WaitForSeconds(incubatingTime));

        infectionState = InfectionState.Asymptomatic;
        yield return(new WaitForSeconds(asymptomaticTime));

        if (willShowSymptoms)
        {
            infectionState        = InfectionState.Symptomatic;
            spriteRenderer.sprite = kSickSprite;
            infectedAudioSource.Play();
            yield return(new WaitForSeconds(symptomaticTime));

            if (willGoCritical)
            {
                numCritical++;
                infectionState        = InfectionState.Critical;
                spriteRenderer.sprite = kCriticalSprite;
                criticalAudioSource.Play();
                rb.velocity = new Vector2(0, 0);
                yield return(new WaitForSeconds(criticalTime));

                numCritical--;

                if (numCritical < kNumCriticalSupported ? willDie : willDieWithoutSupport)
                {
                    deathAudioSource.Play();
                    yield return(new WaitForSeconds(0.3f));

                    numDeaths++;
                    numHumans--;
                    Destroy(gameObject);
                }
            }
        }

        numInfected--;
        infectionState        = InfectionState.Recovered;
        spriteRenderer.sprite = kRecoveredSprite;
    }
        public Material GetStatusMaterial(Infectable iv, InfectionState lastState)
        {
            switch (iv.infectionForm)
            {
            case InfectionForm.AGENT:
                return(agentInfectionMaterials[(int)lastState]);

            case InfectionForm.WAYPOINT:
                return(wayInfectionMaterials[(int)lastState]);

            default:
                return(wayInfectionMaterials[(int)lastState]);
            }
        }
Ejemplo n.º 24
0
        private void UpdateActiveState(float deltaTime, Character character)
        {
            if (state != InfectionState.Active)
            {
                if (Character.Controlled == character)
                {
                    new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
                }
                ActivateHusk(character);
                state = InfectionState.Active;
            }

            character.AddDamage(CauseOfDeath.Husk, 0.5f * deltaTime, null);
        }
Ejemplo n.º 25
0
 private void CleanUpHuman()
 {
     infectionState         = InfectionState.Clean;
     infectionTimerCatP1Red = infectionTimerCatP1RedConst;
     infectionTimerCatP2Blu = infectionTimerCatP2BluConst;
     infectionTimerCatP3Grn = infectionTimerCatP3GrnConst;
     if (cleanMats.Length > 0)
     {
         int randomMat = Random.Range(0, cleanMats.Length);
         meshRenderer.material = cleanMats [randomMat];
     }
     else
     {
         Debug.LogWarning("No materials in the cleanMats array!");
     }
 }
Ejemplo n.º 26
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            float prevTimer = IncubationTimer;

            state = InfectionState.Dormant;

            IncubationTimer += deltaTime / IncubationDuration;

            if (Character.Controlled != character)
            {
                return;
            }

            if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
            {
                GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f);
            }
        }
Ejemplo n.º 27
0
        private void UpdateActiveState(float deltaTime, Character character)
        {
            if (state != InfectionState.Active)
            {
                ActivateHusk(character);
                state = InfectionState.Active;
            }

            foreach (Limb limb in character.AnimController.Limbs)
            {
                character.LastDamageSource = null;
                character.DamageLimb(
                    limb.WorldPosition, limb,
                    new List <Affliction>()
                {
                    AfflictionPrefab.InternalDamage.Instantiate(0.5f * deltaTime / character.AnimController.Limbs.Length)
                },
                    0.0f, false, 0.0f);
            }
        }
Ejemplo n.º 28
0
 public override void Update(CharacterHealth characterHealth, Limb targetLimb, float deltaTime)
 {
     base.Update(characterHealth, targetLimb, deltaTime);
     character = characterHealth.Character;
     if (character == null)
     {
         return;
     }
     if (!subscribedToDeathEvent)
     {
         character.OnDeath     += CharacterDead;
         subscribedToDeathEvent = true;
     }
     if (Strength < DormantThreshold)
     {
         DeactivateHusk();
         State = InfectionState.Dormant;
     }
     else if (Strength < ActiveThreshold)
     {
         DeactivateHusk();
         character.SpeechImpediment = 100;
         State = InfectionState.Transition;
     }
     else if (Strength < Prefab.MaxStrength)
     {
         if (State != InfectionState.Active)
         {
             character.SetStun(Rand.Range(2, 4));
         }
         State = InfectionState.Active;
         ActivateHusk();
     }
     else
     {
         State = InfectionState.Final;
         ActivateHusk();
         ApplyDamage(deltaTime, applyForce: true);
         character.SetStun(1);
     }
 }
Ejemplo n.º 29
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            IncubationTimer += deltaTime / IncubationDuration;

            state = InfectionState.Transition;
        }
Ejemplo n.º 30
0
 public void MakeRemoved()
 {
     infectionState        = InfectionState.Removed;
     spriteRenderer.sprite = removedPersonSprite;
 }