So, I setup the code to get the chest armor condition so I can check when it takes damage. However, it does not seem to register any changes to its condition int values, even when that body part is hit and I take damage. Am I missing how the condition system works? Do normal armor not degrade from being damaged?
Is there a simple way to get what body part the player was hit on last damage?
Here is the code:
Code: Select all
//pump out current condition of chest armor to ensure it is getting damaged.
Debug.Log(GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.ChestArmor).currentCondition);
//check if chest armor is equipped and if so, check its condition against the last time it took damage.
if (compassArmored && GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.ChestArmor).currentCondition != lastArmorHealth)
{
//update the last condition int value it had.
lastArmorHealth = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.ChestArmor).currentCondition;
//find the difference in condition int value to get total damage done to armor.
float difference = lastArmorHealth - GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.ChestArmor).currentCondition;
//pump out debug message for checking values.
Debug.Log("ARMOR HIT: " + difference + " | " + GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.ChestArmor).currentCondition);
//if the difference is greater than 1 and the broken glass hasn't hit its last update texture, then update to next damage effect.
if (difference > 1 && currentDamageTextureID != 4)
{
currentDamageTextureID++;
if (currentDamageTextureID < damageEffectList.Count - 1)
{
damageEffectInstance.UpdateTexture(new Color(1, 1, 1, .9f), damageEffectList[currentDamageTextureID]);
}
}
}