public AbstractEntity AddEntityToUnit(AbstractEntity e, AbstractEntity unit) { CanCarryComponent c = (CanCarryComponent)unit.GetComponent(nameof(CanCarryComponent)); e.AddComponent(new PositionComponent(e, this.map_data, 0, 0, false, false)); c.AddItem(e); return(e); }
public void PickupItem(AbstractEntity unit, AbstractEntity item, List <AbstractEntity> mapSquare) { MobDataComponent mdc = (MobDataComponent)unit.GetComponent(nameof(MobDataComponent)); if (mdc == null || mdc.actionPoints > 0) { mdc.actionPoints -= 40; CanCarryComponent ccc = (CanCarryComponent)unit.GetComponent(nameof(CanCarryComponent)); CarryableComponent cc = (CarryableComponent)item.GetComponent(nameof(CarryableComponent)); // todo - check weight etc... ccc.AddItem(item); cc.carrier = unit; mapSquare.Remove(item); } }