Im making a game with many attack types. Each attack is a script that has 4 segments. Get targets in range, doTargeting, doAttack, doAIAttack.
So in the main attack script everytime I have to get the range of a weapon or ability I do this.
if (targetingType == "Sword")
{
GetComponent().Range();
}
else if (targetingType == "Bomb")
{
GetComponent().Range();
}
else if (targetingType == "Detonate")
{
GetComponent().Range();
}
etc etc etc.
Than the same for Targeting, than again for Attacking. Is here a way to just refference the scripts via a String. So I could use something like GetComponent<"targetingType">().Range();
↧