コード例 #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
         })
コード例 #2
0
 public CoreBase(string name, GameFolder parent, InfectionState infectionState, ScanResult result)
 {
     Name             = name;
     ContainingFolder = parent;
     InfectionState   = infectionState;
     Result           = result;
 }
コード例 #3
0
 public void Infect()
 {
     if (infectionState == InfectionState.Healthy)
     {
         infectionState = InfectionState.InitialInfection;
         numInfected++;
     }
 }
コード例 #4
0
    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;
    }
コード例 #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)));
 }
コード例 #6
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            if (state != InfectionState.Dormant)
            {
                DeactivateHusk(character);
            }

            state = InfectionState.Dormant;
        }
コード例 #7
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            if (state != InfectionState.Transition)
            {
                DeactivateHusk(character);
            }

            state = InfectionState.Transition;
        }
コード例 #8
0
    public void MakeInfected()
    {
        infectionState        = InfectionState.Infected;
        spriteRenderer.sprite = infectedPersonSprite;
        infectedTime          = Time.timeSinceLevelLoad;

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

            IncubationTimer += deltaTime / IncubationDuration;
            state            = InfectionState.Transition;
        }
コード例 #10
0
ファイル: HuskInfection.cs プロジェクト: kachnov/Barotrauma
        private void UpdateActiveState(float deltaTime, Character character)
        {
            if (state != InfectionState.Active)
            {
                ActivateHusk(character);
                state = InfectionState.Active;
            }

            character.AddDamage(CauseOfDeath.Husk, 0.5f * deltaTime, null);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #13
0
 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);
     }
 }
コード例 #14
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            if (state != InfectionState.Dormant)
            {
                DeactivateHusk(character);
            }

            float prevTimer = IncubationTimer;

            state            = InfectionState.Dormant;
            IncubationTimer += deltaTime / IncubationDuration;
        }
コード例 #15
0
    private void CleanUp()
    {
        infectionTimer -= Time.deltaTime;

        if (infectionTimer <= 0)
        {
//			Debug.Log ("Is clean!");
            meshRenderer.material = zoneMats[0];
            infectionState        = InfectionState.Clean;
            infectionTimer        = infectionTimerReset;
        }
    }
コード例 #16
0
ファイル: Program.cs プロジェクト: timerva/AoC2017
        public void IterateState()
        {
            int newState = (int)State;

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

            State = (InfectionState)newState;
        }
コード例 #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;
 }
コード例 #18
0
ファイル: HuskInfection.cs プロジェクト: kachnov/Barotrauma
        private void UpdateDormantState(float deltaTime, Character character)
        {
            float prevTimer = IncubationTimer;

            state = InfectionState.Dormant;

            IncubationTimer += deltaTime / IncubationDuration;

            if (Character.Controlled != character)
            {
                return;
            }
        }
コード例 #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;
        }
コード例 #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));
        }
コード例 #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;
 }
コード例 #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;
    }
コード例 #23
0
        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]);
            }
        }
コード例 #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);
        }
コード例 #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!");
     }
 }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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);
     }
 }
コード例 #29
0
ファイル: HuskInfection.cs プロジェクト: kachnov/Barotrauma
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            IncubationTimer += deltaTime / IncubationDuration;

            state = InfectionState.Transition;
        }
コード例 #30
0
 public void MakeRemoved()
 {
     infectionState        = InfectionState.Removed;
     spriteRenderer.sprite = removedPersonSprite;
 }