public bool AddEntity(Entity user, Entity toAdd) { if (equippedEntities.Any(x => x.Value == toAdd)) { return(false); } else { EquippableComponent eqCompo = toAdd.GetComponent <EquippableComponent>(ComponentFamily.Equippable); if (eqCompo != null) { if (activeSlots.Contains(eqCompo.wearloc) && !equippedEntities.ContainsKey(eqCompo.wearloc)) { equippedEntities.Add(eqCompo.wearloc, toAdd); eqCompo.currentWearer = this.Owner; return(true); } else { return(false); } } else { return(false); } } }
public bool RemoveEntity(Entity user, Entity toRemove) { if (equippedEntities.Any(x => x.Value == toRemove)) { EquippableComponent eqCompo = toRemove.GetComponent <EquippableComponent>(ComponentFamily.Equippable); if (eqCompo != null) { eqCompo.currentWearer = null; } equippedEntities[equippedEntities.First(x => x.Value == toRemove).Key] = null; return(true); } else { return(false); } }