/// <summary> /// Checks if it's possible to remove this body part and runs any logic /// required upon it's removal. /// </summary> /// <returns>True if allowed to remove. Flase if gibbing.</returns> private bool BodyPartRemovalChecks() { //Checks if the body part is not an internal organ and if that part shares a skin tone. if (IsSurface && BodyPartItemInheritsSkinColor && currentBurnDamageLevel != BurnDamageLevels.CHARRED) { CharacterSettings settings = HealthMaster.gameObject.Player().Script.characterSettings; ColorUtility.TryParseHtmlString(settings.SkinTone, out Tone); BodyPartItemSprite.OrNull()?.SetColor(Tone); } if (currentBurnDamageLevel == BurnDamageLevels.CHARRED) { BodyPartItemSprite.OrNull()?.SetColor(bodyPartColorWhenCharred); } //Fixes an error where externally bleeding body parts would continue to try bleeding even after their removal. if (IsBleedingExternally) { StopExternalBleeding(); } if (gibsEntireBodyOnRemoval) { healthMaster.Gib(); return(false); } //If this body part is necessary for a character existence, kill them upon removal. if (DeathOnRemoval) { healthMaster.Death(); } return(true); }
/// <summary> /// Sets the color of the body part item that is removed /// </summary> private void SetRemovedColor() { if (IsSurface && BodyPartItemInheritsSkinColor && currentBurnDamageLevel != TraumaDamageLevel.CRITICAL) { CharacterSettings settings = HealthMaster.gameObject.Player().Script.characterSettings; ColorUtility.TryParseHtmlString(settings.SkinTone, out Tone); BodyPartItemSprite.OrNull()?.SetColor(Tone); } if (currentBurnDamageLevel == TraumaDamageLevel.CRITICAL) { BodyPartItemSprite.OrNull()?.SetColor(bodyPartColorWhenCharred); } }
protected void SetUpPipes() { if (pipeData.PipeAction == null) { pipeData.PipeAction = new MonoActions(); } registerTile.SetPipeData(pipeData); pipeData.MonoPipe = this; int Offset = PipeFunctions.GetOffsetAngle(transform.localRotation.eulerAngles.z); pipeData.Connections.Rotate(Offset); pipeData.OnEnable(); spritehandler.OrNull()?.gameObject.OrNull()?.SetActive(true); spritehandler.OrNull()?.SetColor(Colour); }
/// <summary> /// Sets the color of the body part item that is removed /// </summary> private void SetRemovedColor() { if (currentBurnDamageLevel == TraumaDamageLevel.CRITICAL) { BodyPartItemSprite.OrNull()?.SetColor(bodyPartColorWhenCharred); } }
//Called when camera is deactivated or reactivated, e.g loss of power or wires cut/repaired //Or when camera is destroyed private void ServerSetCameraState(bool newState) { cameraActive = newState; spriteHandler.OrNull()?.ChangeSprite(cameraActive ? 1 : 0); OnStateChange.Invoke(newState); //On state change, resync number of active cameras SyncNumberOfCameras(); }