Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SequenceItem.js --
- private static var numItems = 20;
- private static var items : Transform[];
- public var index = -1; // (value when not set)
- function Start() {
- if (items == null)
- {
- // probably needs error checking: will fail if objects not named/don't exist/don't have script attached!
- items = Transform[numItems];
- for (var n = 1; n <= numItems; ++n) {
- items[n] = GameObject.Find("item "+n).transform;
- var sequenceItem : SequenceItem = items[n].GetComponent("SequenceItem");
- sequenceItem.index = n;
- }
- }
- }
- function OnMouseDown() {
- // need error checking here
- var nextItem = items[index+1];
- var prevItem = items[index-1];
- }
Advertisement
Add Comment
Please, Sign In to add comment