|
It seems easy enough, but I might be over-complicating things... (again). Basically, I'm trying to make a function that will replace a GameObject with one that is either next or previous in a list of GameObjects. I couldn't fully understand the few methods in the MSDN reference I thought that would help (IndexOf, FindIndex, etc). Psuedo Code:
(comments are locked)
|
|
I believe I found a way: Um wouldn't that be easier as:
Jul 14 '12 at 03:16 PM
whydoidoit
I swear if that works, I'm gonna kill you :D
Jul 14 '12 at 03:18 PM
SirVictory
And it does :I
Jul 14 '12 at 03:21 PM
SirVictory
:) Somethings are easier than they look!
Jul 14 '12 at 03:22 PM
whydoidoit
Yeah, I neglected to remember that a list is like an array :P
Jul 14 '12 at 03:25 PM
SirVictory
(comments are locked)
|
var selectedNumber :int;
var Hats = List ;
var selectedHat :GameObject;
function ChooseNextHat() {
selectedHat = Hats[selectedNumber + 1];
selectedNumber ++;
}
function ChooseLastHat(){
selectedHat = Hats[selectedNumber - 1];
selectedNumber --;
}
This should do it. I haven't tested it yet
(comments are locked)
|

I wrote an answer it just has to be allowed so wait a minute