//public override Texture LoadImage() { return (Texture)EditorGUIUtility.LoadRequired("bend_help.png"); }

    public override bool Inspector()
    {
        MegaSpherify mod = (MegaSpherify)target;

        EditorGUIUtility.LookLikeControls();
        mod.percent = EditorGUILayout.FloatField("Percent", mod.percent);
        mod.FallOff = EditorGUILayout.FloatField("FallOff", mod.FallOff);
        return(false);
    }
예제 #2
0
    //public override Texture LoadImage() { return (Texture)EditorGUIUtility.LoadRequired("bend_help.png"); }

    public override bool Inspector()
    {
        MegaSpherify mod = (MegaSpherify)target;

#if !UNITY_5 && !UNITY_2017 && !UNITY_2018 && !UNITY_2019 && !UNITY_2020
        EditorGUIUtility.LookLikeControls();
#endif
        mod.percent = EditorGUILayout.FloatField("Percent", mod.percent);
        mod.FallOff = EditorGUILayout.FloatField("FallOff", mod.FallOff);
        return(false);
    }
예제 #3
0
    void Update()
    {
        float t =  120 * Time.deltaTime * timescale * stageTime;
        // Find the stretch msph
        if ( !msph )
        {
            msph = GetComponent<MegaSpherify>();
        }

        if ( msph )
        {

            if (per >= 0){
                swap = false;
                stageTime = 0.7f;
            }

            if(per <=-30){
                swap = true;
                stageTime = 0.3f;
            }

            if(swap){
                per = per + t;

            }
            if(!swap){
                per = per - t;
                }

                //delay update

            msph.percent = per;

            //Debug.Log(t);
        }
        //		Debug.Log(amt);
        // For Squeeze

        if ( !msqz )
        {
            msqz = GetComponent<MegaSqueeze>();

        }

        diff = uprev - defControl.def;

        if ( msqz )
        {

        //if (defControl.deprMM >= 20){
            if(diff != 0){

            amt = amt + diff * coefficientForSqueeze; //was 0.02f
            gRot = gRot - diff * gRotInc;

            uprev = defControl.def;

            transform.position = transform.position - new Vector3(0.0f*diff, -0.02f*diff, -0.03f*diff);

                }
            //else
            //amt = 0;
            //}

        //transform.position = transform.position + new Vector3(0.002*diff, 0.001*diff, 0.002*diff);

            msqz.amount = amt;
            //msqz.gizmoRot.Set(gRot.x,gRot.y,gRot.z);

        }
    }
예제 #4
0
    void ShowGUI(MegaModifier mod)
    {
        switch (mod.ModName())
        {
        case "Bend":
        {
            MegaBend bmod = (MegaBend)mod;
            bmod.angle    = AngleSlider("Angle", bmod.angle, 2.0f);
            bmod.dir      = AngleSlider("Direction", bmod.dir, 1.0f);
            bmod.axis     = (MegaAxis)XYZ("Axis", (int)bmod.axis);
            bmod.doRegion = GUILayout.Toggle(bmod.doRegion, "DoRegion");
            if (bmod.doRegion)
            {
                bmod.from = Slider("From", bmod.from, -40.0f, 0.0f);
                bmod.to   = Slider("To", bmod.to, 0.0f, 40.0f);
            }
        }
        break;

        case "Hump":
            MegaHump hmod = (MegaHump)mod;
            Vector3  size = mod.bbox.Size();
            float    sz   = size.magnitude * 4.0f;
            hmod.amount  = ProSlider("Amount", hmod.amount, -2.0f, 2.0f, sz);                           //objsize);
            hmod.cycles  = Slider("Cycles", hmod.cycles, 0.0f, 20.0f);
            hmod.phase   = Slider("Phase", hmod.phase, 0.0f, 10.0f);
            hmod.axis    = (MegaAxis)XYZ("Axis", (int)hmod.axis);
            hmod.animate = GUILayout.Toggle(hmod.animate, "Animate");
            if (hmod.animate)
            {
                hmod.speed = Slider("Speed", hmod.speed, -10.0f, 10.0f);
            }
            break;

        case "Twist":
        {
            MegaTwist tmod = (MegaTwist)mod;
            tmod.angle    = AngleSlider("Angle", tmod.angle, 2.0f);
            tmod.Bias     = Slider("Bias", tmod.Bias, -40.0f, 40.0f);
            tmod.axis     = (MegaAxis)XYZ("Axis", (int)tmod.axis);
            tmod.doRegion = GUILayout.Toggle(tmod.doRegion, "DoRegion");
            if (tmod.doRegion)
            {
                tmod.from = Slider("From", tmod.from, -40.0f, 0.0f);
                tmod.to   = Slider("To", tmod.to, 0.0f, 40.0f);
            }
        }
        break;

        case "Taper":
        {
            MegaTaper tmod = (MegaTaper)mod;

            tmod.amount   = Slider("Amount", tmod.amount, -10.0f, 10.0f);
            tmod.axis     = (MegaAxis)XYZ("Axis", (int)tmod.axis);
            tmod.EAxis    = (MegaEffectAxis)EAxisXYZ("EffectAxis", (int)tmod.EAxis);
            tmod.dir      = AngleSlider("Direction", tmod.dir, 1.0f);
            tmod.crv      = Slider("Curve", tmod.crv, -10.0f, 10.0f);
            tmod.sym      = GUILayout.Toggle(tmod.sym, "Symmetry");
            tmod.doRegion = GUILayout.Toggle(tmod.doRegion, "Limit Effect");

            if (tmod.doRegion)
            {
                tmod.from = ProSlider("From", tmod.from, 0.0f, 1.0f, objsize);
                tmod.to   = ProSlider("To", tmod.to, 0.0f, 1.0f, objsize);
            }
        }
        break;

        case "FFD3x3x3":
            MegaFFD fmod = (MegaFFD)mod;
            for (int i = 0; i < 27; i++)
            {
                string name = "p" + i;
                fmod.pt[i] = ProSlider(name, ref fmod.pt[i], -2.0f, 2.0f, objsize);
            }
            break;

        case "Noise":
            MegaNoise nmod = (MegaNoise)mod;
            nmod.Scale    = Slider("Scale", nmod.Scale, 0.0f, 10.0f);
            nmod.Freq     = Slider("Freq", nmod.Freq, 0.0f, 30.0f);
            nmod.Phase    = Slider("Phase", nmod.Phase, 0.0f, 10.0f);
            nmod.Strength = ProSlider("Strength", ref nmod.Strength, 0.0f, 1.0f, objsize);
            nmod.Animate  = GUILayout.Toggle(nmod.Animate, "Animate");
            nmod.Fractal  = GUILayout.Toggle(nmod.Fractal, "Fractal");
            if (nmod.Fractal)
            {
                nmod.Rough      = Slider("Rough", nmod.Rough, 0.0f, 1.0f);
                nmod.Iterations = Slider("Iterations", nmod.Iterations, 0.0f, 10.0f);
            }
            break;

        case "Ripple":
            MegaRipple rmod = (MegaRipple)mod;
            rmod.animate = GUILayout.Toggle(rmod.animate, "Animate");
            if (rmod.animate)
            {
                rmod.Speed = Slider("Speed", rmod.Speed, -4.0f, 4.0f);
            }

            rmod.amp   = ProSlider("Amp", rmod.amp, -1.0f, 1.0f, objsize);
            rmod.amp2  = ProSlider("Amp2", rmod.amp2, -1.0f, 1.0f, objsize);
            rmod.flex  = Slider("Flex", rmod.flex, -10.0f, 10.0f);
            rmod.wave  = Slider("Wave", rmod.wave, -25.0f, 25.0f);
            rmod.phase = Slider("Phase", rmod.phase, -100.0f, 100.0f);
            rmod.Decay = Slider("decay", rmod.Decay, 0.0f, 500.0f);
            break;

        case "Wave":
            MegaWave wmod = (MegaWave)mod;
            wmod.animate = GUILayout.Toggle(wmod.animate, "Animate");
            if (wmod.animate)
            {
                wmod.Speed = Slider("Speed", wmod.Speed, -4.0f, 4.0f);
            }

            wmod.amp   = ProSlider("Amp", wmod.amp, -1.0f, 1.0f, objsize * 0.75f);
            wmod.amp2  = ProSlider("Amp2", wmod.amp2, -1.0f, 1.0f, objsize * 0.75f);
            wmod.flex  = Slider("Flex", wmod.flex, -10.0f, 10.0f);
            wmod.wave  = Slider("Wave", wmod.wave, -100.0f, 100.0f);
            wmod.phase = Slider("Phase", wmod.phase, -100.0f, 100.0f);
            wmod.Decay = Slider("decay", wmod.Decay, 0.0f, 50.0f);
            wmod.dir   = Slider("Direction", wmod.dir, 0.0f, 90.0f);
            break;

        case "Stretch":
        {
            MegaStretch smod = (MegaStretch)mod;
            smod.amount  = Slider("Amount", smod.amount, -4.0f, 4.0f);
            smod.amplify = Slider("Amplify", smod.amplify, -2.0f, 2.0f);
            smod.axis    = (MegaAxis)XYZ("Axis", (int)smod.axis);
        }
        break;

        case "Bubble":
        {
            MegaBubble bmod = (MegaBubble)mod;
            bmod.radius  = ProSlider("Radius", bmod.radius, -1.0f, 4.0f, objsize);
            bmod.falloff = ProSlider("Falloff", bmod.falloff, -1.0f, 1.0f, objsize);
        }
        break;

        case "Spherify":
        {
            MegaSpherify smod = (MegaSpherify)mod;
            smod.percent = Slider("Percent", smod.percent, 0.0f, 100.0f);
        }
        break;

        case "Skew":
        {
            MegaSkew smod = (MegaSkew)mod;
            smod.amount = ProSlider("Amount", smod.amount, -2.0f, 2.0f, objsize);
            smod.dir    = AngleSlider("Dir", smod.dir, 1.0f);
            smod.axis   = (MegaAxis)XYZ("Axis", (int)smod.axis);
        }
        break;

        case "Melt":
            MegaMelt mmod = (MegaMelt)mod;
            mmod.Amount = Slider("Amount ", mmod.Amount, 0.0f, 100.0f);
            mmod.Spread = Slider("Spread", mmod.Spread, 0.0f, 100.0f);

            InitMatList();
            GUILayout.Label("Solidity");
            mmod.MaterialType = (MegaMeltMat)GUILayout.SelectionGrid((int)mmod.MaterialType, MatList, 2, "toggle");

            if (mmod.MaterialType == MegaMeltMat.Custom)
            {
                mmod.Solidity = Slider("Custom", mmod.Solidity, 0.0f, 10.0f);
            }

            mmod.axis     = (MegaAxis)XYZ("Axis", (int)mmod.axis);
            mmod.FlipAxis = GUILayout.Toggle(mmod.FlipAxis, "Flip Axis");
            break;
        }
    }