Esempio n. 1
0
 private void Awake()
 {
     circulatorySystem     = GetComponent <CirculatorySystemBase>();
     healthMaster          = GetComponent <LivingHealthMasterBase>();
     playerScript          = GetComponent <PlayerScript>();
     objectBehaviour       = GetComponent <ObjectBehaviour>();
     healthStateController = GetComponent <HealthStateController>();
 }
Esempio n. 2
0
        public void Heartbeat(float efficiency)
        {
            if (efficiency > 1)
            {
                efficiency = 1;
            }
            CirculatorySystemBase circulatorySystem = RelatedPart.HealthMaster.CirculatorySystem;

            if (circulatorySystem)
            {
                float totalWantedBlood = 0;
                foreach (BodyPart implant in RelatedPart.HealthMaster.BodyPartList)
                {
                    if (implant.IsBloodCirculated == false)
                    {
                        continue;
                    }
                    totalWantedBlood += implant.BloodThroughput;
                }
                float pumpedReagent = Math.Min(totalWantedBlood * efficiency, circulatorySystem.BloodPool.Total);

                foreach (BodyPart implant in RelatedPart.HealthMaster.BodyPartList)
                {
                    if (implant.IsBloodCirculated == false)
                    {
                        continue;
                    }
                    implant.BloodPumpedEvent((implant.BloodThroughput / totalWantedBlood) * pumpedReagent);
                }
                if (RelatedPart.HealthMaster.IsDead)
                {
                    return;                                                  //For some reason the heart will randomly still continue to try and beat after death.
                }
                if (RelatedPart.BloodContainer.CurrentReagentMix.MajorMixReagent == salt || RelatedPart.BloodContainer.AmountOfReagent(salt) * 100 > dangerSaltLevel)
                {
                    Chat.AddActionMsgToChat(RelatedPart.HealthMaster.gameObject,
                                            "<color=red>Your body spasms as a jolt of pain surges all over your body then into your heart!</color>",
                                            $"<color=red>{RelatedPart.HealthMaster.playerScript.visibleName} spasms before holding " +
                                            $"{RelatedPart.HealthMaster.playerScript.characterSettings.TheirPronoun(RelatedPart.HealthMaster.playerScript)} chest in shock before falling to the ground!</color>");
                    RelatedPart.HealthMaster.Death();
                }
            }
        }
Esempio n. 3
0
 public override void SetUpSystems()
 {
     circ      = bodyPart.HealthMaster.GetComponent <CirculatorySystemBase>();
     blood     = RelatedPart.BloodContainer;
     tempArray = new List <Tuple <Reagent, float> >();
 }