Oh… now I understand why you said this overcomplicates things.
Look, I’m not trying to be mean, but the one that needs to be in context is you.
I suggested using the
CompareTag method instead because of the following block of code:
private void OnTriggerEnter(Collider other)
if(other.gameObject.tag == "Fuel")
Debug.Log("Jet Fuel, keeps you going")
That’s the block of code the student was talking about. This has nothing to do with refactoring the
Switch statement. Read the entire post, check the student’s code, and then give feedback, don’t just assume things.
One last thing, I never said that
Switch statements shouldn’t be used, that’s you, and you alone, I don’t like that “never do this” mentality when coding, yes, there are good practices and bad practices, but sometimes bad practices are the right way to go, it depends on the situation, for instance, in the studio I’m currently working, one of the Writers has no idea how to use Unity, so we created a JSON database that basically renders the real-time part of the engine obsolete, terrible idea, yes, but it helps our writer get things done without having to learn a new tool on a rush, the writer can take time thanks to that system. Never say never.