void Start() { dragSprite = GameObject.Find("DraggerMouse").GetComponent <DragSprite>(); recttrans = GetComponent <RectTransform>(); current = false; previous = false; }
void Start() { data = GameObject.Find("GameDataManager").GetComponent <ItemData>(); player = GameObject.FindGameObjectWithTag("Player"); dragSprite = GameObject.Find("DraggerMouse").GetComponent <DragSprite>(); itemUIs = new Image[itemPoint.Length]; systems = new ItemSystem[itemPoint.Length]; for (int i = 0; i < itemPoint.Length; i++) { itemUIs[i] = itemPoint[i].GetComponent <Image>(); systems[i] = itemPoint[i].GetComponent <ItemSystem>(); } SetItemList(); SetAction(); }
/// <summary> /// Constructs the internal sprites needed for our demo. /// </summary> public DragMode() { // Create the fragment marbles int rows = 3; int cols = 3; int sx = (SpriteDemosMain.Size.Width - cols * 50) / 2; int sy = (SpriteDemosMain.Size.Height - rows * 50) / 2; SurfaceCollection m1 = LoadMarble("marble1"); SurfaceCollection m2 = LoadMarble("marble2"); AnimationCollection anim1 = new AnimationCollection(); anim1.Add(m1); AnimationCollection anim2 = new AnimationCollection(); anim2.Add(m2); AnimationDictionary frames = new AnimationDictionary(); frames.Add("marble1", anim1); frames.Add("marble2", anim2); DragSprite dragSprite; for (int i = 0; i < cols; i++) { Thread.Sleep(10); for (int j = 0; j < rows; j++) { dragSprite = new DragSprite(frames["marble1"], new Point(sx + i * 50, sy + j * 50) ); dragSprite.Animations.Add("marble1", anim1); dragSprite.Animations.Add("marble2", anim2); dragSprite.Animate = true; if (Randomizer.Next(2) == 1) { dragSprite.AnimateForward = false; } Thread.Sleep(10); Sprites.Add(dragSprite); } } }