public void Initialize(List <Unit> units) { for (int i = 0; i < Size; ++i) { int index = (i - lrSize) % units.Count; ButtonMorpher bm = MakeButton(); if (i >= lrSize) { bm.GetComponent <Button>().image.sprite = units[index].icon; } bm.desiredPos = -Vector3.up * 100 + Vector3.right * 100 * (i - lrSize);//Vector3.right*600 + Vector3.up*800 + Vector3.right * 100 * i; bm.desiredSize = i == lrSize ? 1 : 0.6f; bm.desiredAlpha = 1f - (float)Mathf.Abs(lrSize - i) / (lrSize); bm.transform.SetParent(transform); buttons.Add(bm); } }
public void ChangeFuture(List <Unit> units) { for (int i = lrSize; i < buttons.Count;) { //if (buttons[i].gameObject == null) // return; Destroy(buttons[i].gameObject); buttons.RemoveAt(i); } for (int i = 0; i < lrSize + 1; ++i) { ButtonMorpher bm = MakeButton(); int index = i % units.Count; bm.GetComponent <Button>().image.sprite = units[index].icon; bm.desiredPos = -Vector3.up * 100 + Vector3.right * 100 * (i);//Vector3.right*600 + Vector3.up*800 + Vector3.right * 100 * i; bm.desiredSize = i == 0 ? 1 : 0.6f; bm.desiredAlpha = 1f; //bm.desiredAlpha = 1f - (float)Mathf.Abs(i) / (lrSize); bm.transform.SetParent(transform); buttons.Add(bm); } }
public void NewTurn(List <Unit> units) { if (justMade) { justMade = false; return; } Destroy(buttons[0].gameObject); buttons.RemoveAt(0); ButtonMorpher bm = MakeButton(); int index = (lrSize) % units.Count; bm.GetComponent <Button>().image.sprite = units[index].icon; bm.transform.SetParent(transform); buttons.Add(bm); for (int i = 0; i < buttons.Count; ++i) { buttons[i].desiredPos = -Vector3.up * 100 + Vector3.right * 100 * (i - lrSize); buttons[i].desiredSize = i == lrSize ? 1 : 0.6f; buttons[i].desiredAlpha = 1f - (float)Mathf.Abs(lrSize - i) / (lrSize); } }