Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

Is there a way to get scripts via string?

$
0
0
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();

Viewing all articles
Browse latest Browse all 215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>