- Home /
How to Substitute Coroutine in non-MonoBehaviour Class?
Hi, what happen is, I have a Weapon Class, which is not a Monobehaviour.
The Weapon has Internal Battery that recharge itself over time.
I need to use control how fast it recharge via rechargeRate;
Conditions:
Battery size is int 100; This Design must not be change. Recharge rate must be integer.
The Weapon is Control via Manager, which is a Monobehaviour
However, the Manager also control other Weapons, which might not have battery.
I think a good idea might be creating RechargableWeapon class, derive it from Weapon and move your battery variable to this class. And then, in your weapon manager, you can check if this particular weapon is of proper type, which should allow you to track battery status.
Your answer
Follow this Question
Related Questions
Return value from coroutine 2 Answers
Taking a sequence of screenshots 1 Answer
Starting Coroutine within Start method 1 Answer
Method returning data from WWW 1 Answer
How to stop coroutines or functions 2 Answers