public override void SetDestination(SpellNode newDestination)
    {
        if (newDestination != oldDestination)
        {
            selectedLinkableProperty  = null;
            linkedActivatableFunction = null;

            if (newDestination != null)
            {
                availableLinkableProperties = new List <string>(LinkableFinder.FindAllLinkableProperty(newDestination));
                activatableFunctions        = new List <string>(LinkableFinder.FindLinkableFunctions(newDestination, true));
                oldDestination = newDestination;
                destination    = newDestination;
            }
        }
    }
    public void UpdateSourceAndDestination()
    {
        oldSource      = source;
        oldDestination = destination;

        if (source != null)
        {
            availableProperties = new List <string>(LinkableFinder.FindLinkableFunctions(source));
        }

        if (destination != null)
        {
            availableLinkableProperties = new List <string>(LinkableFinder.FindAllLinkableProperty(destination));
            activatableFunctions        = new List <string>(LinkableFinder.FindLinkableFunctions(destination, true));
        }
    }
Esempio n. 3
0
    public void UpdateSelectSensitiveDropdowns()
    {
        // Update Linkable Properties Sink
        string[] linkProperties = LinkableFinder.FindAllLinkableProperty(selectedMagicCircle);
        linkablePropertiesSink.options.Clear();
        for (int i = 0; i < linkProperties.Length; i++)
        {
            print("new prop: " + linkProperties[i]);
            linkablePropertiesSink.options.Add(new Dropdown.OptionData(linkProperties[i]));
        }
        linkablePropertiesSink.RefreshShownValue();

        if (selectedMagicCircle != null)
        {
            // Update Main types Dropdown
            mainTypeDropdown.value = (int)selectedMagicCircle.GetMcType();

            // Update sub types Dropdown
            subTypeDropdown.value = selectedMagicCircle.GetSubType();
        }
    }
    void Update()
    {
        if (source != oldSource)
        {
            selectedProperty          = null;
            boolLinkedFunction        = null;
            linkedActivatableFunction = null;

            if (source != null)
            {
                availableProperties = new List <string>(LinkableFinder.FindLinkableFunctions(source));
                oldSource           = source;
            }
        }

        if (destination != oldDestination)
        {
            selectedLinkableProperty  = null;
            linkedActivatableFunction = null;

            if (destination != null)
            {
                availableLinkableProperties = new List <string>(LinkableFinder.FindAllLinkableProperty(destination));
                activatableFunctions        = new List <string>(LinkableFinder.FindLinkableFunctions(destination, true));
                oldDestination = destination;
            }
        }


        if (link)
        {
            link = false;
            if (source != null && destination != null)
            {
                if (previousLinkedProperty != null && previousLinkedProperty != selectedLinkableProperty)
                {
                    ResetProperty(previousLinkedProperty);
                }
                if (selectedProperty != null)
                {
                    // Link properties
                    if (selectedLinkableProperty != null)
                    {
                        Type[] conversionTypes = GetConversion();
                        if (conversionTypes[0] != null)
                        {
                            PickConversionTypes(conversionTypes[0], conversionTypes[1]);
                        }
                        else
                        {
                            Debug.LogWarning("Failed to match one value with the destination or source");
                        }
                    }
                    // Link bool to activator function
                    if (selectedActivatableFunction != null)
                    {
                        LinkActivatorFunction();
                    }
                }
            }
        }

        DrawLink();
    }