Exemple #1
0
    public void RebuildAction(Component trigger)
    {
        MetaActionData metaData = metaTriggerData.allowedActions.Find(x => trigger.GetType() == x.actionType);

        if (metaData != null)
        {
            GameObject newAction = MakeAction(metaData);
            newAction.GetComponent <ActionUI>().realAction = trigger;
            if (metaData.creator(uiElements) != null)
            {
                GameObject actionCreator = Instantiate(metaData.creator(uiElements));
                actionCreator.transform.SetParent(newAction.transform);
            }
        }
    }
Exemple #2
0
    private void MakeNewAction()
    {
        string trigger_name = action_selector.options[action_selector.value].text;

        MetaActionData metaData = metaTriggerData.allowedActions.Find(x => x.name.Equals(trigger_name));

        if (metaData == null)
        {
            return;
        }
        Component action = realTrigger.gameObject.AddComponent(metaData.actionType);

        metaTriggerData.addAction(realTrigger, action);
        GameObject newAction = MakeAction(metaData);

        newAction.GetComponent <ActionUI>().realAction = action;
        if (metaData.creator(uiElements) != null)
        {
            GameObject actionCreator = Instantiate(metaData.creator(uiElements));
            actionCreator.transform.parent = newAction.transform;
        }
    }