/// <summary>
/// Begins the combat state of the player. Sets AttackCharging.
/// Animates the weapon becoming ready.
/// For ranged weaponry it checks for the weapon ammo.
/// </summary>
public override void CombatBegin()
{
chargeRate = 10f * (GetWeaponSpeed());
if (IsMelee())
{///If melee sets the proper weapon drawn back animation.
CurrentStrike = GetStrikeType();
CurrentStrikeAnimation = GetStrikeOffset();
UWHUD.instance.wpa.SetAnimation = GetWeaponOffset() + CurrentStrikeAnimation + GetHandOffset() + 0; //charge
}
else
{
///If ranged check for ammo as defined by the Weapon
/// If ammo if found give the player a targeting crosshair
currentAmmo = UWCharacter.Instance.playerInventory.findObjInteractionByID(currWeaponRanged.AmmoType());
if ((currentAmmo == null) && (ObjectInteraction.Alias(currWeaponRanged.AmmoType()) != currWeaponRanged.AmmoType()))
{//Ammo type has an alias. try and find that instead.
currentAmmo = UWCharacter.Instance.playerInventory.findObjInteractionByID(ObjectInteraction.Alias(currWeaponRanged.AmmoType()));
}
if (currentAmmo == null)
{//No ammo.
UWHUD.instance.MessageScroll.Add("Sorry, you have no " + StringController.instance.GetObjectNounUW(currWeaponRanged.AmmoType()));
return;
}
else
{
//Change the crosshair
UWHUD.instance.CursorIcon = UWHUD.instance.CursorIconTarget;
}
}
///Starts the counter
AttackCharging = true;
Charge = 0;
}