Exemplo n.º 1
0
    override public void ShowGUI()
    {
        linkedProp = (Moveable)EditorGUILayout.ObjectField("Object to transform:", linkedProp, typeof(Moveable), true);

        EditorGUILayout.BeginHorizontal();
        transformType = (TransformType)EditorGUILayout.EnumPopup(transformType);
        toBy          = (ToBy)EditorGUILayout.EnumPopup(toBy);
        EditorGUILayout.EndHorizontal();

        newVector      = EditorGUILayout.Vector3Field("Vector:", newVector);
        transitionTime = EditorGUILayout.Slider("Transition time:", transitionTime, 0, 10f);

        if (transitionTime > 0f)
        {
            moveMethod = (MoveMethod)EditorGUILayout.EnumPopup("Move method", moveMethod);
            willWait   = EditorGUILayout.Toggle("Pause until finish?", willWait);
        }

        AfterRunningOption();
    }
Exemplo n.º 2
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI ("Moveable object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID = 0;
                linkedProp = null;
            }
            else
            {
                linkedProp = (Moveable) EditorGUILayout.ObjectField ("Moveable object:", linkedProp, typeof (Moveable), true);

                constantID = FieldToID <Moveable> (linkedProp, constantID);
                linkedProp = IDToField <Moveable> (linkedProp, constantID, false);
            }

            EditorGUILayout.BeginHorizontal ();
            transformType = (TransformType) EditorGUILayout.EnumPopup (transformType);
            if (transformType != TransformType.CopyMarker)
            {
                toBy = (ToBy) EditorGUILayout.EnumPopup (toBy);
            }
            EditorGUILayout.EndHorizontal ();

            if (transformType == TransformType.CopyMarker)
            {
                markerParameterID = Action.ChooseParameterGUI ("Marker:", parameters, markerParameterID, ParameterType.GameObject);
                if (markerParameterID >= 0)
                {
                    markerID = 0;
                    marker = null;
                }
                else
                {
                    marker = (Marker) EditorGUILayout.ObjectField ("Marker:", marker, typeof (Marker), true);

                    markerID = FieldToID <Marker> (marker, markerID);
                    marker = IDToField <Marker> (marker, markerID, false);
                }

            }
            else
            {
                newVector = EditorGUILayout.Vector3Field ("Vector:", newVector);
            }
            transitionTime = EditorGUILayout.Slider ("Transition time:", transitionTime, 0, 10f);

            if (transitionTime > 0f)
            {
                if (transformType == TransformType.Rotate)
                {
                    doEulerRotation = EditorGUILayout.Toggle ("Euler rotation?", doEulerRotation);
                }
                moveMethod = (MoveMethod) EditorGUILayout.EnumPopup ("Move method", moveMethod);
                if (moveMethod == MoveMethod.CustomCurve)
                {
                    timeCurve = EditorGUILayout.CurveField ("Time curve:", timeCurve);
                }
                willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait);
            }

            AfterRunningOption ();
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle("Move Player?", isPlayer);
            if (!isPlayer)
            {
                parameterID = Action.ChooseParameterGUI("Moveable object:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    linkedProp = null;
                }
                else
                {
                    linkedProp = (Moveable)EditorGUILayout.ObjectField("Moveable object:", linkedProp, typeof(Moveable), true);

                    constantID = FieldToID <Moveable> (linkedProp, constantID);
                    linkedProp = IDToField <Moveable> (linkedProp, constantID, false);
                }
            }

            EditorGUILayout.BeginHorizontal();
            transformType = (TransformType)EditorGUILayout.EnumPopup(transformType);
            if (transformType != TransformType.CopyMarker)
            {
                toBy = (ToBy)EditorGUILayout.EnumPopup(toBy);
            }
            EditorGUILayout.EndHorizontal();

            if (transformType == TransformType.CopyMarker)
            {
                markerParameterID = Action.ChooseParameterGUI("Marker:", parameters, markerParameterID, ParameterType.GameObject);
                if (markerParameterID >= 0)
                {
                    markerID = 0;
                    marker   = null;
                }
                else
                {
                    marker = (Marker)EditorGUILayout.ObjectField("Marker:", marker, typeof(Marker), true);

                    markerID = FieldToID <Marker> (marker, markerID);
                    marker   = IDToField <Marker> (marker, markerID, false);
                }
            }
            else
            {
                setVectorMethod = (SetVectorMethod)EditorGUILayout.EnumPopup("Vector is: ", setVectorMethod);
                if (setVectorMethod == SetVectorMethod.EnteredHere)
                {
                    newVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, newVectorParameterID, ParameterType.Vector3);
                    if (newVectorParameterID < 0)
                    {
                        newVector = EditorGUILayout.Vector3Field("Value:", newVector);
                    }
                }
                else if (setVectorMethod == SetVectorMethod.FromVector3Variable)
                {
                    if (isAssetFile)
                    {
                        variableLocation = VariableLocation.Global;
                    }
                    else
                    {
                        variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation);
                    }

                    if (variableLocation == VariableLocation.Global)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                    else if (variableLocation == VariableLocation.Local)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                }

                clearExisting = EditorGUILayout.Toggle("Stop existing transforms?", clearExisting);
            }

            if (transformType == TransformType.CopyMarker ||
                (transformType == TransformType.Translate && toBy == ToBy.To) ||
                (transformType == TransformType.Rotate && toBy == ToBy.To))
            {
                inWorldSpace = EditorGUILayout.Toggle("Act in world-space?", inWorldSpace);

                if (inWorldSpace && transformType == TransformType.CopyMarker)
                {
                    EditorGUILayout.HelpBox("The moveable object's scale will be changed in local space.", MessageType.Info);
                }
            }

            transitionTimeParameterID = Action.ChooseParameterGUI("Transition time (s):", parameters, transitionTimeParameterID, ParameterType.Float);
            if (transitionTimeParameterID < 0)
            {
                transitionTime = EditorGUILayout.FloatField("Transition time (s):", transitionTime);
            }

            if (transitionTime > 0f)
            {
                if (transformType == TransformType.Rotate)
                {
                    doEulerRotation = EditorGUILayout.Toggle("Euler rotation?", doEulerRotation);
                }
                moveMethod = (MoveMethod)EditorGUILayout.EnumPopup("Move method:", moveMethod);
                if (moveMethod == MoveMethod.CustomCurve)
                {
                    timeCurve = EditorGUILayout.CurveField("Time curve:", timeCurve);
                }
                willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
            }

            AfterRunningOption();
        }
Exemplo n.º 4
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI("Moveable object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID = 0;
                linkedProp = null;
            }
            else
            {
                linkedProp = (Moveable)EditorGUILayout.ObjectField("Moveable object:", linkedProp, typeof(Moveable), true);

                constantID = FieldToID <Moveable> (linkedProp, constantID);
                linkedProp = IDToField <Moveable> (linkedProp, constantID, false);
            }

            EditorGUILayout.BeginHorizontal();
            transformType = (TransformType)EditorGUILayout.EnumPopup(transformType);
            if (transformType != TransformType.CopyMarker)
            {
                toBy = (ToBy)EditorGUILayout.EnumPopup(toBy);
            }
            EditorGUILayout.EndHorizontal();

            if (transformType == TransformType.CopyMarker)
            {
                markerParameterID = Action.ChooseParameterGUI("Marker:", parameters, markerParameterID, ParameterType.GameObject);
                if (markerParameterID >= 0)
                {
                    markerID = 0;
                    marker   = null;
                }
                else
                {
                    marker = (Marker)EditorGUILayout.ObjectField("Marker:", marker, typeof(Marker), true);

                    markerID = FieldToID <Marker> (marker, markerID);
                    marker   = IDToField <Marker> (marker, markerID, false);
                }
            }
            else
            {
                newVector = EditorGUILayout.Vector3Field("Vector:", newVector);
            }
            transitionTime = EditorGUILayout.Slider("Transition time:", transitionTime, 0, 10f);

            if (transitionTime > 0f)
            {
                if (transformType == TransformType.Rotate)
                {
                    doEulerRotation = EditorGUILayout.Toggle("Euler rotation?", doEulerRotation);
                }
                moveMethod = (MoveMethod)EditorGUILayout.EnumPopup("Move method", moveMethod);
                if (moveMethod == MoveMethod.CustomCurve)
                {
                    timeCurve = EditorGUILayout.CurveField("Time curve:", timeCurve);
                }
                willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
            }

            AfterRunningOption();
        }