/// <summary> /// Register this cell in the mask rendering script /// </summary> private void Start() { MaskRenderer.RegisterCell(this); }
/// <summary> /// Equip something from SpriteCollection. /// </summary> public override void Equip(SpriteGroupEntry item, EquipmentPart part, Color?color) { switch (part) { case EquipmentPart.MeleeWeapon1H: CompositeWeapon = null; break; case EquipmentPart.MeleeWeapon2H: CompositeWeapon = null; Shield = null; break; case EquipmentPart.Bow: PrimaryWeapon = SecondaryWeapon = null; Shield = null; break; case EquipmentPart.Crossbow: PrimaryWeapon = SecondaryWeapon = null; Shield = null; break; case EquipmentPart.SecondaryFirearm1H: CompositeWeapon = null; Shield = null; break; } switch (part) { case EquipmentPart.Helmet: HideEars = item != null && !item.Tags.Contains("ShowEars"); CropHair = item != null && !item.Tags.Contains("FullHair"); Helmet = HelmetRenderer.GetComponent <SpriteMapping>().FindSprite(item?.Sprites); HelmetRenderer.color = color ?? HelmetRenderer.color; break; case EquipmentPart.Armor: Armor = item?.Sprites.ToList(); ArmorRenderers.ForEach(i => i.color = color ?? i.color); break; case EquipmentPart.Vest: SetArmorParts(VestRenderers, item?.Sprites, color); break; case EquipmentPart.Bracers: SetArmorParts(BracersRenderers, item?.Sprites, color); break; case EquipmentPart.Leggings: SetArmorParts(LeggingsRenderers, item?.Sprites, color); break; case EquipmentPart.MeleeWeapon1H: PrimaryWeapon = item?.Sprite; PrimaryWeaponRenderer.color = color ?? (item != null && item.Tags.Contains("Paint") ? PrimaryWeaponRenderer.color : Color.white); if (WeaponType != WeaponType.Paired) { WeaponType = WeaponType.Melee1H; } break; case EquipmentPart.MeleeWeapon2H: PrimaryWeapon = item?.Sprite; PrimaryWeaponRenderer.color = color ?? (item != null && item.Tags.Contains("Paint") ? PrimaryWeaponRenderer.color : Color.white); WeaponType = WeaponType.Melee2H; break; case EquipmentPart.Bow: CompositeWeapon = item?.Sprites.ToList(); WeaponType = WeaponType.Bow; break; case EquipmentPart.Crossbow: CompositeWeapon = item?.Sprites.ToList(); WeaponType = WeaponType.Crossbow; break; case EquipmentPart.SecondaryFirearm1H: SecondaryWeapon = SecondaryWeaponRenderer.GetComponent <SpriteMapping>().FindSprite(item?.Sprites); WeaponType = WeaponType.Paired; break; case EquipmentPart.Shield: Shield = item?.Sprites.ToList(); WeaponType = WeaponType.Melee1H; break; case EquipmentPart.Cape: Cape = item?.Sprite; CapeRenderer.color = color ?? CapeRenderer.color; break; case EquipmentPart.Back: Back = item?.Sprite; BackRenderer.color = color ?? BackRenderer.color; WeaponType = WeaponType.Melee1H; break; case EquipmentPart.Earrings: Earrings = item?.Sprites.ToList(); EarringsRenderers[0].color = EarringsRenderers[1].color = color ?? EarringsRenderers[0].color; break; case EquipmentPart.Mask: Mask = MaskRenderer.GetComponent <SpriteMapping>().FindSprite(item?.Sprites); MaskRenderer.color = color ?? MaskRenderer.color; break; default: throw new NotImplementedException($"Unsupported part: {part}."); } Initialize(); }
/// <summary> /// Register this building in the mask rendering script /// </summary> private void Start() { MaskRenderer.RegisterBuilding(this); }