예제 #1
0
	public Weapon.WieldType GetFirstWeaponWieldType() {
		Weapon.WieldType result = Weapon.WieldType.none;
		// if the Actor has any Weapons equipped
		if (equipment.OfType<Weapon>().Any()) {
			// get first equipped weapon's type
			Weapon equippedWeapon = equipment.OfType<Weapon>().First();
			result = equippedWeapon.GetWieldType();
		}
		return result;
	}
예제 #2
0
	// method to check if the Actor has a Weapon equipped with a given WieldType
	public bool HasEquippedWeaponWieldType (Weapon.WieldType wieldType) {
		// if the Actor has any Weapons equipped
		if (equipment.OfType<Weapon>().Any()) {
			List<Weapon> equippedWeapons = AllWeapons; // get all equipped Weapons
			// then compare the passed WieldType against the equipped Weapon WieldTypes
			foreach (Weapon equippedWeapon in equippedWeapons) {
				// return true if there is a match
				if (equippedWeapon.GetWieldType() == wieldType) {
					return true;
				}
			}
		}
		else {
			return false;
		}
		return false;
	}