Ejemplo n.º 1
0
    private void OnEnable()
    {
        if (transform.GetChild(0).GetComponent <DirectionalDriveFacade>())
        {
            dirDriveFacade = transform.GetChild(0).gameObject.GetComponent <DirectionalDriveFacade>();
        }
        else if (transform.GetChild(0).GetComponent <RotationalDriveFacade>())
        {
            rotDriveFacade = transform.GetChild(0).gameObject.GetComponent <RotationalDriveFacade>();
        }
        else
        {
            //Debug.LogError("No Drive a 0 child");
            return;
        }

        interactibleObject = GetComponentInChildren <InteractibleObject>();
        valueEventsParent  = transform.GetChild(transform.childCount - 1);
        CheckValueEvents();

        if (valueEvents == null)
        {
            valueEvents = new List <ValueEvent>();
        }
    }
Ejemplo n.º 2
0
    void ShowDriveSettings()
    {
        GUILayout.Space(10);

        MyEditorTools.BeginHorizontal();

        bool driveBool = EditorGUILayout.BeginFoldoutHeaderGroup(drive.driveBool, "Drive Settings");

        EditorGUILayout.EndFoldoutHeaderGroup();

        MyEditorTools.ShowRefrenceButton(
            drive.driveType == DriveObject.DriveType.Directional ?
            drive.dirDriveFacade.gameObject :
            drive.rotDriveFacade.gameObject);

        MyEditorTools.EndHorizontal();

        if (drive.driveBool != driveBool)
        {
            Undo.RecordObject(drive, "Toggled driveBool");
            drive.driveBool = driveBool;
        }

        if (drive.driveBool)
        {
            if (drive.driveType == DriveObject.DriveType.Directional)
            {
                DirectionalDriveFacade facade = drive.dirDriveFacade;

                facade.DriveAxis = (DriveAxis.Axis)EditorGUILayout.EnumPopup("Drive Axis", facade.DriveAxis);

                facade.MoveToTargetValue = EditorGUILayout.Toggle("Move To Target Value", facade.MoveToTargetValue);
                facade.TargetValue       = EditorGUILayout.Slider("Target Value", facade.TargetValue, 0, 1);
                facade.DriveSpeed        = EditorGUILayout.FloatField("Drive Speed", facade.DriveSpeed);
            }

            else
            {
                RotationalDriveFacade facade = drive.rotDriveFacade;

                facade.DriveAxis = (DriveAxis.Axis)EditorGUILayout.EnumPopup("Drive Axis", facade.DriveAxis);

                facade.MoveToTargetValue = EditorGUILayout.Toggle("Move To Target Value", facade.MoveToTargetValue);
                facade.TargetValue       = EditorGUILayout.Slider("Target Value", facade.TargetValue, 0, 1);
                facade.DriveSpeed        = EditorGUILayout.FloatField("Drive Speed", facade.DriveSpeed);
            }

            ShowDriveLimit();
        }
    }