/// <summary> /// Equipts all items that are currently equipt /// </summary> /// <param name="eqMan"></param> private void EquiptStartItems(EquiptmentManager eqMan) { //Iterate all possible slots foreach (LoadedEquiptmentPlacement lep in MiscUtils.GetValues <LoadedEquiptmentPlacement>()) { EquiptableItem eqIt = eqMan.GetEquiptItem(lep); if (eqIt != null) { SetEquiptmentItem(lep, eqIt); } else { eqIt = eqMan.GetDefaultItem(lep); if (eqIt != null) { SetEquiptmentItem(lep, eqIt); } } } }
protected override void ChooseEquiptWeapon() { Vector2 combatDisp = CurrentTarget.Position2 - Entity.Position2; float distance = combatDisp.magnitude; EquiptmentManager eqMan = (Entity as HumanoidEntity).EquiptmentManager; Item currentlyEquipt = eqMan.GetEquiptItem(LoadedEquiptmentPlacement.weaponHand); //If we are unarmed if (currentlyEquipt == null) { //Check distance, if large distance & we have a range weapon, equipt it if (distance > 8 && eqMan.HasRangeWeapon()) { eqMan.EquiptRangeWeapon(); } //If we are either close, or we have no range weapon, check for range weapon else if (eqMan.HasMeleeWeapon()) { eqMan.EquiptMeleeWeapon(); } } else if (currentlyEquipt is RangeWeapon) {//If the currently equipt weapon is a range weapon //If we are close to the enemy, try to equipt a melee weapon if (distance < 5 && eqMan.HasMeleeWeapon()) { eqMan.EquiptMeleeWeapon(); } } else if (currentlyEquipt is Weapon) {//If we currently have a melee weapon if (distance > 10 && eqMan.HasRangeWeapon()) { eqMan.EquiptRangeWeapon(); } } }
public Bandit() : base(new BasicHumanoidCombatAI(), new CreatureTaskAI(), new EntityMovementData(4, 8, 4)) { EquiptmentManager.AddDefaultItem(new Trousers(new ItemMetaData().SetColor(Color.blue))); EquiptmentManager.AddDefaultItem(new Shirt(new ItemMetaData().SetColor(Color.green))); Inventory.AddItem(new SteelLongSword()); }
public HumanoidEntity(EntityCombatAI combatAI, EntityTaskAI taskAI, EntityMovementData movementData, string name = "un-named_entity", bool isFixed = false) : base(combatAI, taskAI, movementData, name, isFixed) { EquiptmentManager = new EquiptmentManager(this); }