public void SetBeatInfo(int[] antes) { foreach (JhChip jhChip in ChipList) { Destroy(jhChip.gameObject); } ChipList.Clear(); UISprite spr = GetComponent <UISprite>(); for (int i = 0; i < antes.Length; i++) { GameObject chip = Instantiate(ChipPrefab); chip.SetActive(true); chip.transform.parent = ChipCrid.transform; chip.transform.localScale = Vector3.one; JhChip c = chip.GetComponent <JhChip>(); c.SetChip(i, antes[i]); ChipList.Add(c); } float x = Math.Abs(ChipCrid.transform.localPosition.x); x *= 2; x += (ChipList.Count - 1) * ChipCrid.cellWidth; spr.width = (int)x; ChipCrid.Reposition(); }
public void Beat(int index, int value) { GameObject chip = Instantiate(ChipPrefab); chip.transform.parent = transform; chip.transform.localPosition = GetToPos(); chip.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); foreach (UIWidget wg in chip.GetComponentsInChildren <UIWidget>()) { wg.depth = deep++; } JhChip c = chip.GetComponent <JhChip>(); c.SetChip(index, value); ChipList.Add(chip); }
public void Beat(GameObject startPos, int index, int value) { GameObject chip = Instantiate(ChipPrefab); chip.transform.parent = transform; chip.transform.localPosition = startPos.transform.localPosition; chip.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); foreach (UIWidget wg in chip.GetComponentsInChildren <UIWidget>()) { wg.depth = deep++; } TweenPosition twPos = chip.GetComponent <TweenPosition>(); twPos.@from = chip.transform.localPosition; twPos.to = GetToPos(); twPos.PlayForward(); JhChip c = chip.GetComponent <JhChip>(); c.SetChip(index, value); ChipList.Add(chip); }