public void RebuildTrigger(Component trigger) { MetaTriggerData metaData = metaDroneData.allowedTriggers.Find(x => trigger.GetType() == x.triggerType); if (metaData != null) { GameObject newTrigger = MakeTrigger(metaData); newTrigger.GetComponent <TriggerUI>().realTrigger = trigger; if (metaData.creator(uiElements) != null) { GameObject triggerCreator = Instantiate(metaData.creator(uiElements)); triggerCreator.transform.parent = newTrigger.transform; } } }
private void MakeNewTrigger() { string trigger_name = trigger_selector.options[trigger_selector.value].text; MetaTriggerData metaData = metaDroneData.allowedTriggers.Find(x => x.name.Equals(trigger_name)); Component newTrigger = realDrone.gameObject.AddComponent(metaData.triggerType); GameObject triggerUI = MakeTrigger(metaData); triggerUI.GetComponent <TriggerUI>().realTrigger = newTrigger; Instantiate(metaData.creator(uiElements)).transform.parent = triggerUI.transform; }
private void MakeNewTrigger() { string trigger_name = trigger_selector.options[trigger_selector.value].text; MetaTriggerData metaData = metaFormationData.allowedTriggers.Find(x => x.name.Equals(trigger_name)); realFormation.gameObject.AddComponent(metaData.triggerType); Component[] triggers = realFormation.GetComponents(metaData.triggerType); Component newTrigger = triggers[triggers.Length - 1]; GameObject triggerUI = MakeTrigger(metaData); triggerUI.GetComponent <TriggerUI>().realTrigger = newTrigger; Instantiate(metaData.creator(uiElements)).transform.SetParent(triggerUI.transform); }