public void AttachEntry(EnemyListEntryController elec) { moving = true; GameObject go = Instantiate(Resources.Load("Prefabs/EnemyListEntry")) as GameObject; go.transform.SetParent(canvas.transform, false); EnemyListEntryController nelec = go.GetComponent <EnemyListEntryController>(); nelec.ConfigureFromTemplate(elec.GetEnemyTemplate()); floatingEntry = nelec; floatingEntry.floating = true; Vector3 inputPos = InputWatcher.GetInputPosition(); floatingEntry.transform.position = new Vector3(inputPos.x, inputPos.y, -1.0f); }
public void AddNewEntry(EnemyTemplateController etc) { GameObject go = Instantiate(Resources.Load("Prefabs/EnemyListEntry")) as GameObject; EnemyListEntryController elec = go.GetComponent <EnemyListEntryController>(); elec.transform.SetParent(scroll.transform, false); elec.ConfigureFromTemplate(etc); RectTransform rt = (RectTransform)elec.transform; rt.anchoredPosition = new Vector2(rt.anchoredPosition.x, rt.anchoredPosition.y - spacing * enemies.Count); if (enemies.Count == 0) { initialpos = rt.anchoredPosition.y; } enemies.Add(elec); elec.parentZonePanel = this; ResizeScroll(); GameEvent ge = new GameEvent("wave_editor_changed"); EventManager.Instance().RaiseEvent(ge); }