IEnumerator Show(LinkedPanel toShowPanel) { Vector3 from = panel.position; Vector3 to = from + selected.panel.position - toShowPanel.panel.position; float t = 1; while (t > 0.001f) { t *= 0.9f; panel.position = Vector3.Lerp(from, to, 1 - t); yield return(null); } panel.position = to; selected = toShowPanel; }
public void Init() { panel.gameObject.GetComponent <GridLayoutGroup>().cellSize = panel.rect.size; LinkedPanel main = new LinkedPanel(); LinkedPanel unit = new LinkedPanel(); LinkedPanel option = new LinkedPanel(); main.panel = mainPanel; main.Down = unit; main.Right = option; unit.panel = unitSelectionPanel; unit.Up = main; option.panel = optionPanel; option.Left = main; selected = main; }