public void AttachEnemy(EnemyTemplateController etc) { moving = true; GameObject go = Instantiate (Resources.Load ("Prefabs/DraggableEnemy")) as GameObject; go.transform.SetParent(canvas.transform,false); EnemyDraggableController edc = go.GetComponent<EnemyDraggableController>(); edc.ConfigureFromTemplate(etc); floatingEnemy = edc; //make draggable controller based on etc stats //make floatingEnemy that controller and dispose of the old one if applicable }
public void AttachEnemy(EnemyTemplateController etc) { moving = true; GameObject go = Instantiate(Resources.Load("Prefabs/DraggableEnemy")) as GameObject; go.transform.SetParent(canvas.transform, false); EnemyDraggableController edc = go.GetComponent <EnemyDraggableController>(); edc.ConfigureFromTemplate(etc); floatingEnemy = edc; //make draggable controller based on etc stats //make floatingEnemy that controller and dispose of the old one if applicable }
public void DropEnemy() { //figure out which zone panel to drop it on for(int i = 0; i < 6; i++){ if(zonepanels[i].GlowIsOn()){ zonepanels[i].AddNewEntry(floatingEnemy); break; } } moving = false; if(floatingEnemy != null) Destroy (floatingEnemy.gameObject); floatingEnemy = null; }
public void AddNewEntry(EnemyDraggableController entry) { GameObject go = Instantiate (Resources.Load ("Prefabs/EnemyListEntry")) as GameObject; EnemyListEntryController elec = go.GetComponent<EnemyListEntryController>(); elec.transform.SetParent(scroll.transform,false); elec.ConfigureFromTemplate(entry.GetEnemyTemplate()); 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); }
public void DropEnemy() { //figure out which zone panel to drop it on for (int i = 0; i < 6; i++) { if (zonepanels[i].GlowIsOn()) { zonepanels[i].AddNewEntry(floatingEnemy); break; } } moving = false; if (floatingEnemy != null) { Destroy(floatingEnemy.gameObject); } floatingEnemy = null; }
public void AddNewEntry(EnemyDraggableController entry) { AddNewEntry(entry.GetEnemyTemplate()); }