/// <summary> /// creates a new weapon /// </summary> /// <param name="aName">the name of the weapon</param> /// <param name="aGlyph">the weapon glyph</param> /// <param name="aColor">the weapon colour</param> /// <param name="l">the weapon location.</param> /// <param name="aWProps">weapon properties</param> /// <param name="aLoc">worn location</param> /// <param name="aSubType">weapon subtype</param> public Weapon(string aName, char aGlyph, Colour aColor, Location3i l, WeaponProperties aWProps, WeaponLocation aLoc, WeaponSubType aSubType) : base(ItemType.Weapon, aName, aGlyph, aColor, l) { WeaponProperties = aWProps; WeaponSubType = aSubType; WeaponLocation = aLoc; }
public void ShootWeapon(WeaponLocation weaponLocation) { WeaponSlot slot; if (weaponSlots.TryGetValue(weaponLocation, out slot)) { slot.ShootWeapon(); } else { DebugLogger.LogError("ShootWeapon(): Invalid WeaponLocation!"); } }
public void CycleWeapon(WeaponLocation weaponLocation) { //initiate moving to next weapon //don't actually change until weapon gets locked in by delay WeaponSlot slot; if (weaponSlots.TryGetValue(weaponLocation, out slot)) { slot.CycleWeapon(); } else { DebugLogger.LogError("CycleWeapon(): Invalid WeaponLocation!"); } }
public int GetEquippedWeaponIndex(WeaponLocation weaponLocation) { int index = 0; WeaponSlot slot; if (weaponSlots.TryGetValue(weaponLocation, out slot)) { index = slot.equippedWeaponIndex; } else { DebugLogger.LogError("ShootWeapon(): Invalid WeaponLocation!"); } return index; }
public void EquipCurrentWeapon(WeaponLocation weaponLocation) { WeaponSlot slot; if (weaponSlots.TryGetValue(weaponLocation, out slot)) { if (!slot.StartEquipWeapon()) { //weapon has no animator, wait for generic delay then finish equipping StartCoroutine(WaitAndEquip(noAnimationEquipDelay, slot.weaponLocation)); } } else { DebugLogger.LogError("EquipCurrentWeapon(): Invalid WeaponLocation!"); } }
public void DisplayImage(WeaponLocation weaponLocation, Sprite sprite) { switch (weaponLocation) { case WeaponLocation.Primary: SetImage(primaryWeaponImage, sprite); break; case WeaponLocation.Secondary: SetImage(secondaryWeaponImage, sprite); break; case WeaponLocation.Utility: SetImage(utilityWeaponImage, sprite); break; default: break; } }
public void WeaponEquipped(WeaponLocation weaponLocation) { //weapon equip animation finished, weapon is ready to fire WeaponSlot slot; if (weaponSlots.TryGetValue(weaponLocation, out slot)) { slot.FinishEquipWeapon(); } else { DebugLogger.LogError("WeaponEquipped(): Invalid WeaponLocation!"); } }
//public void UnequipCurrentWeapon(WeaponLocation weaponLocation) //{ // WeaponSlot slot; // if (weaponSlots.TryGetValue(weaponLocation, out slot)) // { // if (!slot.ChangeWeapons()) // { // //if this slot does not have an animator, use a generic delay then continue equipping // StartCoroutine(WaitAndUnequip(noAnimationEquipDelay, slot.weaponLocation)); // } // } // else // { // DebugLogger.LogError("UnequipCurrentWeapon(): Invalid WeaponLocation!"); // } //} IEnumerator WaitAndUnequip(float waitTime, WeaponLocation weaponLocation) { yield return new WaitForSeconds(waitTime); WeaponUnequipped(weaponLocation); }
//public void ForceSelectWeapon(WeaponLocation weaponLocation) //{ //} public void WeaponUnequipped(WeaponLocation weaponLocation) { EquipCurrentWeapon(weaponLocation); }