/// <summary> /// Behaviour, when the trigger button is pressed. /// If the map is currently selected, consider this a delete /// If the map is not selected, draw a new map /// <returns></returns> /// public override GameObject OnTriggerPressed(Transform direction) { if (!this.IsSelected()) { //Create the gameObject for the map and then Draw it. GameObject mapGameObject = new GameObject(); mapGameObject.transform.parent = this.transform.root; MapContainer main = mapGameObject.AddComponent(typeof(MapContainer)) as MapContainer; main?.Draw(this, this.GetLevel() + 1, this.transform.parent.transform, direction); this.selected = true; CreateLine(); this.GetInternalFlows(main); return(main.gameObject); } else { //On Deselect Remove it from the current list and Delete the object and its children this.selected = false; DestoryLine(); this.DeleteChildren(); return(null); } }
public MapContainer draw_map(Transform direction) { //Create the gameObject for the map and then Draw it. GameObject mapGameObject = new GameObject(); mapGameObject.transform.parent = this.transform.root; MapContainer main = mapGameObject.AddComponent(typeof(MapContainer)) as MapContainer; main?.Draw(this, this.GetLevel() + 1, this.transform.parent.transform, direction); this.selected = true; CreateLine(); this.GetInternalFlows(main); return(main); }