public void OnFormChanged(int value)
    {
        FormMagicCircle fmc = (FormMagicCircle)selectedSpellNode;

        if (fmc != null)
        {
            fmc.SetForm(formData.GetForm());
        }
    }
Ejemplo n.º 2
0
    public void OnCreateMC()
    {
        if (spell == null)
        {
            CreateSpell();
        }
        if (rootMagicCircle == null || !rootMagicCircle.Contains((int)mcType))
        {
            if (mcType == MagicCircleType.None)
            {
                rootMagicCircle = null;
            }
            OnEmissionRateChanged(value1Slider.value);
            Transform pos = rootMagicCircle == null ? defaultMagicCircle.transform : rootMagicCircle.transform;
            // GameObject newObj = Instantiate( defaultMagicCircle, pos ) as GameObject;
            // newObj.name = mcType.ToString() + " Magic Circle";
            SpellNode newNode = spell.AddNode(mcType);
            newNode.name = mcType.ToString() + " Magic Circle";
            MagicCircle newMc;
            switch (mcType)
            {
            case MagicCircleType.Element:
                ElementMagicCircle tempMC = newNode as ElementMagicCircle;
                // tempMC.SetMcType( mcType );
                tempMC.SetElement((ElementType)subType);
                tempMC.emissionRate.SetDefaultValue(emissionRate);
                newMc = tempMC as MagicCircle;
                break;

            case MagicCircleType.Form:
                FormMagicCircle tempFormMC = newNode as FormMagicCircle;
                // tempMC.SetMcType( mcType );
                // tempMC.SetElement( (ElementType) subType );
                tempFormMC.SetForm((FormType)subType);
                tempFormMC.sizeMultiplier.SetDefaultValue(sizeMultiplier);
                newMc = tempFormMC as MagicCircle;
                break;

            case MagicCircleType.Movement:
                MovementMagicCircle tempMovementMC = newNode as MovementMagicCircle;
                // tempMC.SetMcType( mcType );
                // tempMC.SetElement( (ElementType) subType );
                tempMovementMC.SetMovement((MovementType)subType);
                tempMovementMC.force.SetDefaultValue(force);
                newMc = tempMovementMC as MagicCircle;
                break;

            default:
                newMc = newNode as MagicCircle;
                newMc.SetMcType(mcType);
                break;
            }
            if (rootMagicCircle == null)
            {
                rootMagicCircle = newMc;
            }
            else
            {
                // rootMagicCircle.AddMagicCircle( newMc );
            }
            selectedMagicCircle = newMc;
        }
    }