I have 3 characters in the scene - C1, C2, and C3. When the player presses the number 1 on the keyboard, I want C2 and C3 to be disabled, while C1 is set to be enabled. And when the player presses 2, I want C1 and C3 to be disabled while C2 is set to be enabled. All 3 characters are generated and created accordingly by scripting when the scene is loaded (They are custom characters defined by the user). Right now, this is what the script looks like:
asked Sep 27 '10 at 08:41 PM
See these 2 posts:
answered Dec 05 '10 at 12:58 PM
I'm not quite sure I understand the question - it looks like you know how to acquire references to each of the three characters, so what part are you stuck on? It looks like you're pretty much there.
In your example code, there's no reason for the 'Character*' variables not to be local (at least not that I can see). However, it can sometimes be advantageous to cache references to game objects rather than acquiring them on demand. (Sometimes though the latter is necessary, or at least preferable, and I doubt you'll see any difference in performance either way in this case.)
As for your question, it seems the code to activate one character and disable the other two would look something like this (untested):
Is that what you're looking for?
answered Sep 28 '10 at 01:12 AM