Question, in my armor system, when you equip said item I need it to turn on the MeshRenderer of the correct item.
My player has all equipment on him, just turned off. So, when I equip a “mask” I want the mask to turn on the MeshRenderer of the correct item.
Below is my script:
public class ArmorConfig : StatsEquipableItem
[SerializeField] GameObject gameObject = null;
[SerializeField] float armorRating = 5f;
[SerializeField] float damageResistance = 0;
const string armorName = "Armor";
public Armor Spawn()
{
DestroyOldWeapon(gameObject);
Armor armor = null;
if (gameObject != null)
{
MeshRenderer m = gameObject.GetComponent<MeshRenderer>();
m.enabled = true;
armor.gameObject.name = armorName;
}
return armor;
}
private void DestroyOldWeapon(GameObject equippedArmor)
{
MeshRenderer m = gameObject.GetComponent<MeshRenderer>();
m.enabled = false;
}
public float GetArmor()
{
return armorRating;
}
public float GetResistance()
{
return damageResistance;
}
}