public override void UnsetArmor(Item oldArmor) { Armor.ClassType classType = ((Armor)oldArmor).type; switch (classType) { case Armor.ClassType.HELMET: { this.helmet.owner = null; this.helmet = null; break; } case Armor.ClassType.CHEST: { this.chestArmor.owner = null; this.chestArmor = null; break; } case Armor.ClassType.SHOES: { this.shoes.owner = null; this.shoes = null; break; } } UpdateCharacterWindow(); }
public override void SetArmor(Item newArmor) { Armor.ClassType classType = ((Armor)newArmor).type; Character.instance.audioSource.PlayOneShot(GameObjectContainers.instance.GetAudioClip(3)); switch (classType) { case Armor.ClassType.HELMET: { if (this.helmet != null) { Character.instance.defence -= ((Armor)this.helmet).baseDefence; this.AddItem(this.helmet); this.helmet = null; } this.helmet = newArmor; Character.instance.defence += ((Armor)newArmor).baseDefence; break; } case Armor.ClassType.CHEST: { if (this.chestArmor != null) { Character.instance.defence -= ((Armor)this.chestArmor).baseDefence; this.AddItem(this.chestArmor); this.chestArmor = null; } this.chestArmor = newArmor; Character.instance.defence += ((Armor)newArmor).baseDefence; break; } case Armor.ClassType.SHOES: { if (this.shoes != null) { Character.instance.defence -= ((Armor)this.shoes).baseDefence; this.AddItem(this.shoes); this.shoes = null; } this.shoes = newArmor; Character.instance.defence += ((Armor)newArmor).baseDefence; break; } } newArmor.owner = this; UpdateInventory(); UpdateCharacterWindow(); }
// Maybe aura effects may added as PostEffects public ArmorEssentials(Armor.ClassType type) { armType = type; }