/// <summary> /// Equips item of type Accessoir in slot. /// </summary> /// <param name="item">The Item to be Equipped</param> /// <param name="slot">Slot in which it will be Equipped</param> /// <returns>Previous value of changed Slot</returns> public Equipment Equip(Accessoir item, int slot = -1) { Accessoir oldAccessoir = null; switch (item.Type) { case AccessoryTypes.Finger: if (slot < 0 || slot > 7) { slot = this.DeterminBestAccessoirSlot(item.Type); } oldAccessoir = this.Fingers[slot]; this.Fingers[slot] = item; break; case AccessoryTypes.Handwrist: if (slot < 0 || slot > 5) { slot = this.DeterminBestAccessoirSlot(item.Type); } oldAccessoir = this.HandWrist[slot]; this.HandWrist[slot] = item; break; case AccessoryTypes.Neck: if (slot < 0 || slot > 1) { slot = this.DeterminBestAccessoirSlot(item.Type); } oldAccessoir = this.Neck[slot]; this.Neck[slot] = item; break; } return(oldAccessoir); }
/// <summary> /// Sets the Value of selected slot to null. /// </summary> /// <param name="type">Type of the Accessoir to DeEquip</param> /// <param name="slot"></param> /// <returns>Previous value of changed Slot</returns> public Accessoir DeEquip(AccessoryTypes type, int slot = 0) { Accessoir oldAccessoir = null; switch (type) { case AccessoryTypes.Finger: if (slot > 7 || slot < 0) { Debug.LogError("Slot of DeEquip(Fingers) out of range"); } else if (this.Fingers[slot] == null) { Debug.LogWarning("Can't DeEquip(Fingers) slot with null"); } else { oldAccessoir = this.Fingers[slot]; this.Fingers[slot] = null; } break; case AccessoryTypes.Handwrist: if (slot > 5 || slot < 0) { Debug.LogError("Slot of DeEquip(Handwrist) out of range"); } else if (this.Fingers[slot] == null) { Debug.LogWarning("Can't DeEquip(Handwrist) slot with null"); } else { oldAccessoir = this.HandWrist[slot]; this.HandWrist[slot] = null; } break; case AccessoryTypes.Neck: if (slot > 1 || slot < 0) { Debug.LogError("Slot of DeEquip(Neck) out of range"); } else if (this.Fingers[slot] == null) { Debug.LogWarning("Can't DeEquip slot(Neck) with null"); } else { oldAccessoir = this.Neck[slot]; this.Neck[slot] = null; } break; } return(oldAccessoir); }