/// <summary> /// Initializes the body part /// </summary> public virtual void HealthMasterSet() { if (BodySpriteSet == false) { //If gendered part then set the sprite limb data to it if (isDimorphic) { LimbSpriteData = new ListSpriteDataSOWithOrder(); LimbSpriteData.SpriteOrder = BodyTypesSprites.SpriteOrder; LimbSpriteData.Sprites = BodyTypesSprites.BodyTypes[(int)HealthMaster.BodyType].Sprites; } else { LimbSpriteData = new ListSpriteDataSOWithOrder(); LimbSpriteData.SpriteOrder = BodyTypesSprites.SpriteOrder; if (BodyTypesSprites.BodyTypes.Count > 0) { LimbSpriteData.Sprites = BodyTypesSprites.BodyTypes[(int)BodyType.NonBinary].Sprites; } } BodySpriteSet = true; } UpdateIcons(); foreach (var bodyPartModification in BodyPartModifications) { bodyPartModification.HealthMasterSet(); } //TODO Make this generic \/ for mobs Storage.SetRegisterPlayer(healthMaster?.GetComponent <RegisterPlayer>()); }
public void SetHealthMaster(LivingHealthMasterBase livingHealth) { HealthMaster = livingHealth; if (livingHealth) { playerSprites = livingHealth.GetComponent <PlayerSprites>(); } if (BodySpriteSet == false) { //If gendered part then set the sprite limb data to it if (isDimorphic) { LimbSpriteData = new ListSpriteDataSOWithOrder(); LimbSpriteData.SpriteOrder = BodyTypesSprites.SpriteOrder; LimbSpriteData.Sprites = BodyTypesSprites.BodyTypes[(int)HealthMaster.BodyType].Sprites; } else { LimbSpriteData = new ListSpriteDataSOWithOrder(); LimbSpriteData.SpriteOrder = BodyTypesSprites.SpriteOrder; if (BodyTypesSprites.BodyTypes.Count > 0) { LimbSpriteData.Sprites = BodyTypesSprites.BodyTypes[(int)BodyType.NonBinary].Sprites; } } BodySpriteSet = true; } UpdateIcons(); SetUpSystemsThis(); var dynamicItemStorage = HealthMaster.GetComponent <DynamicItemStorage>(); if (dynamicItemStorage != null) { var bodyPartUISlots = GetComponent <BodyPartUISlots>(); if (bodyPartUISlots != null) { dynamicItemStorage.Add(bodyPartUISlots); } } //TODO Make this generic \/ for mobs OrganStorage.SetRegisterPlayer(HealthMaster?.GetComponent <RegisterPlayer>()); }
void Awake() { healthMaster = GetComponentInParent <LivingHealthMasterBase>(); foreach (BodyPartSprites b in GetComponentsInParent <BodyPartSprites>()) { if (b.BodyPartType.Equals(BodyPartType)) { Debug.Log(b); } //TODO: Do we need to add listeners for implant removal } if (Storage == null) { Storage = GetComponent <ItemStorage>(); } Storage.ServerInventoryItemSlotSet += ImplantAdded; //TODO Make generic version for mobs \/ Storage.SetRegisterPlayer(healthMaster.GetComponent <RegisterPlayer>()); }