I apologize there is no TLDR; and also I apologize if my terminology is incorrect.
Greetings.
I have 3 scripts, each extending from the previous respectively.
each script has an Interface assigned to it, respectively named according to its base script
Example:
Base script Item.cs →
Interface IItem attached to Item.cs - has itemname, slug, description ect.
Item.cs is extended with Weapon.cs →
Interface IWeapon attached to Weapon.cs - damage, 2h or not, sound effects ect
Weapon.cs is extended with MeleeWeapon.cs
Imelee attached to MeleeWeapon.cs - (stab or slice?), air cut effect graphic ect
(TLDR; Sorta) How do I get itemname from IMelee?
I want it, so only melee weapons can do damage here. I would also like to know what melee weapon was used to do the damage.
I could just pass IItem, IWeapon, and Imelee to where I eventually need them, but it would be much cleaner if I could simply pass IMelee, and get all my info like so:
DoFoo(other.GetComponent<IMelee>());
void DoFoo(Imelee weapon){
print(weapon.itemName);
print(weapon.type); // as in stab, slash, or blunt
}```
I always try to limit my question size, so if more info is needed, do ask!!
Thank you for your time!