public SpellNode AddNode(MagicCircleType type, Transform parent = null)
    {
        if (parent == null)
        {
            parent = transform;
        }
        SpellNode  node;
        GameObject obj = (GameObject)Instantiate(MagicList.defaultSpellNode, parent);

        obj.name = type.ToString() + " Magic Circle";
        switch (type)
        {
        case MagicCircleType.Element:
        {
            node = obj.AddComponent <ElementMagicCircle>();
            break;
        }

        case MagicCircleType.Form:
        {
            node = obj.AddComponent <FormMagicCircle>();
            break;
        }

        case MagicCircleType.Movement:
        {
            node = obj.AddComponent <MovementMagicCircle>();
            break;
        }

        case MagicCircleType.Input:
        {
            node = obj.AddComponent <UserInputNode>();
            break;
        }

        case MagicCircleType.Logic:
        {
            node = obj.AddComponent <LogicNode>();
            break;
        }

        case MagicCircleType.Math:
        {
            Debug.LogWarning("The Math Type doesn't exist yet");
            return(null);

            break;
        }

        default:
        {
            Debug.LogWarning("This type doesn't exist yet");
            return(null);
        }
        }

        AddNode(node);
        return(node);
    }
    public virtual void SetMcType(MagicCircleType newMcType)
    {
        mcType = newMcType;
        if (mySpriteRenderer == null)
        {
            mySpriteRenderer = GetComponent <SpriteRenderer>();
        }
        switch (mcType)
        {
        case MagicCircleType.None:
            mySpriteRenderer.color = Color.white;
            break;

        case MagicCircleType.Element:
            mySpriteRenderer.color = Color.green;
            break;

        case MagicCircleType.Form:
            mySpriteRenderer.color = Color.black;
            break;

        case MagicCircleType.Movement:
            mySpriteRenderer.color = Color.grey;
            break;

        default:
            mySpriteRenderer.color = Color.magenta;
            break;
        }
    }
예제 #3
0
    public void OnMcTypeChanged(int newValue)
    {
        mcType = newValue <= (int)MagicCircleType.END ? (MagicCircleType)newValue : MagicCircleType.END;
        if (!drag)
        {
            selectedMagicCircle = null;
        }

        if (selectedMagicCircle != null)
        {
            mcType = selectedMagicCircle.GetMcType();
            if (newValue != (int)mcType)
            {
                mainTypeDropdown.value = (int)mcType;
            }
        }
        print("mcType = " + mcType);
        if (subTypeDropdown != null)
        {
            switch (mcType)
            {
            case MagicCircleType.Element:
                subTypeDropdown.options.Clear();
                for (int i = (int)ElementType.START; i <= (int)ElementType.END; i++)
                {
                    subTypeDropdown.options.Add(new Dropdown.OptionData((( ElementType )i).ToString()));
                }
                break;

            case MagicCircleType.Form:
                subTypeDropdown.options.Clear();
                for (int i = (int)FormType.START; i <= (int)FormType.END; i++)
                {
                    subTypeDropdown.options.Add(new Dropdown.OptionData((( FormType )i).ToString()));
                }
                break;

            case MagicCircleType.Movement:
                subTypeDropdown.options.Clear();
                for (int i = (int)MovementType.START; i <= (int)MovementType.END; i++)
                {
                    subTypeDropdown.options.Add(new Dropdown.OptionData((( MovementType )i).ToString()));
                }
                break;

            default:
                subTypeDropdown.options.Clear();
                break;
            }
            mainTypeDropdown.RefreshShownValue();
            subTypeDropdown.RefreshShownValue();
        }
    }
 public override void SetMcType(MagicCircleType newMcType)
 {
 }
    // public void RemoveSelectedUISpellNode()
    // {
    //     RemoveUISpellNode( selectedUISN );
    // }

    // public void RemoveUISpellNode( UISpellNode uisn )
    // {
    //     uiSpellNodeList.Remove( uisn );
    //     if( uisn.linkedSpellNode != null )
    //     {
    //         Destroy( uisn.linkedSpellNode );
    //     }
    //     Destroy( uisn );
    // }

    public void OnSpellAdded(MagicCircleType mct)
    {
    }