Exemplo n.º 1
0
	void Update()
	{
		// Find the stretch mod
		if ( !mod )
		{
			mod = GetComponent<MegaStretch>();
			modobj = GetComponent<MegaModifyObject>();
		}

		if ( mod )
		{
			Vector3 pos = transform.position;

			float amt = py - ground;

			if ( amt > 0.0f )
				amt = 0.0f;

			float y = py;
			if ( y < ground )
				y = ground;

			if ( mod.amount == 0.0f && amt == 0.0f )
				modobj.enabled = false;
			else
				modobj.enabled = true;

			mod.amount = (amt / radius);
			pos.y = y;
			transform.position = pos;
		}
	}
Exemplo n.º 2
0
    public override bool Inspector()
    {
        MegaStretch mod = (MegaStretch)target;

        //EditorGUIUtility.LookLikeControls();
        mod.amount  = EditorGUILayout.FloatField("Amount", mod.amount);
        mod.amplify = EditorGUILayout.FloatField("Amplify", mod.amplify);
        mod.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", mod.axis);

        mod.doRegion = EditorGUILayout.Toggle("Do Region", mod.doRegion);
        mod.from     = EditorGUILayout.FloatField("From", mod.from);
        mod.to       = EditorGUILayout.FloatField("To", mod.to);
        return(false);
    }
Exemplo n.º 3
0
    public override bool Inspector()
    {
        MegaStretch mod = (MegaStretch)target;

#if !UNITY_5
        EditorGUIUtility.LookLikeControls();
#endif
        mod.amount  = EditorGUILayout.FloatField("Amount", mod.amount);
        mod.amplify = EditorGUILayout.FloatField("Amplify", mod.amplify);
        mod.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", mod.axis);

        //mod.useheightaxis = EditorGUILayout.BeginToggleGroup("Use Height Axis", mod.useheightaxis);
        //mod.axis1 = (MegaAxis)EditorGUILayout.EnumPopup("Height Axis", mod.axis1);
        //EditorGUILayout.EndToggleGroup();

        mod.doRegion = EditorGUILayout.Toggle("Do Region", mod.doRegion);
        mod.from     = EditorGUILayout.FloatField("From", mod.from);
        mod.to       = EditorGUILayout.FloatField("To", mod.to);
        return(false);
    }
    void Update()
    {
        // Find the stretch mod
        if (!mod)
        {
            mod    = GetComponent <MegaStretch>();
            modobj = GetComponent <MegaModifyObject>();
        }

        if (mod)
        {
            Vector3 pos = transform.position;

            float amt = py - ground;

            if (amt > 0.0f)
            {
                amt = 0.0f;
            }

            float y = py;
            if (y < ground)
            {
                y = ground;
            }

            if (mod.amount == 0.0f && amt == 0.0f)
            {
                modobj.enabled = false;
            }
            else
            {
                modobj.enabled = true;
            }

            mod.amount         = (amt / radius);
            pos.y              = y;
            transform.position = pos;
        }
    }
Exemplo n.º 5
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;
        }
    }