Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        LerpTest test = target as LerpTest;

        test.min = EditorGUILayout.FloatField("Minimun Value:", test.min);
        if (test.min > test.max)
        {
            test.min = test.max;
        }
        test.max = EditorGUILayout.FloatField("Maximun Value:", test.max);
        test.t   = EditorGUILayout.Slider("T value:", test.t, 0f, 1f);
        EditorGUI.BeginDisabledGroup(true);
        EditorGUILayout.FloatField("Resultado:", Mathf.Lerp(test.min, test.max, test.t));
        EditorGUI.EndDisabledGroup();
    }
    public override void OnInspectorGUI()
    {
        LerpTest lp = target as LerpTest;

        lp.min = EditorGUILayout.FloatField("min", lp.min);
        lp.max = EditorGUILayout.FloatField("max", lp.max);

        if (lp.min <= lp.max)
        {
            lp.t = EditorGUILayout.Slider("t", lp.t, 0f, 1f);
        }
        if (lp.min > lp.max)
        {
            lp.min = lp.max;
            lp.t   = EditorGUILayout.Slider("t", lp.t, 0f, 1f);
        }

        float x = Mathf.Lerp(lp.min, lp.max, lp.t);

        EditorGUILayout.FloatField("Lerp", x);
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        // if the singleton hasn't been initialized yet
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;//Avoid doing anything else
        }

        instance = this;
        DontDestroyOnLoad(this.gameObject);

        startPos[0] = Cube.transform.localPosition;
        startPos[1] = Sphere.transform.localPosition;
        startPos[2] = Cylinder.transform.localPosition;
        startPos[3] = Cone.transform.localPosition;
        DestPos[0]  = CubeDest.transform.localPosition;
        DestPos[1]  = SphereDest.transform.localPosition;
        DestPos[2]  = CylinderDest.transform.localPosition;
        DestPos[3]  = ConeDest.transform.localPosition;

        ConeRotataion = Cone.transform.localRotation;
        Debug.Log("hello");
    }