예제 #1
0
    public static void CreateBrakeLight()
    {
        if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>())
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Ok");
        }
        else
        {
            GameObject lightsMain;

            if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.Find(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.name + "/Lights"))
            {
                lightsMain = new GameObject("Lights");
                lightsMain.transform.SetParent(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.transform, false);
            }
            else
            {
                lightsMain = Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.Find(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.name + "/Lights").gameObject;
            }

            GameObject brakeLight = GameObject.Instantiate(RCC_Settings.Instance.brakeLights, lightsMain.transform.position, lightsMain.transform.rotation) as GameObject;
            brakeLight.name = RCC_Settings.Instance.brakeLights.name;
            brakeLight.transform.SetParent(lightsMain.transform);
            brakeLight.transform.localRotation = Quaternion.identity;
            brakeLight.transform.localPosition = new Vector3(0f, 0f, -2f);
            RCC_LabelEditor.SetIcon(brakeLight, RCC_LabelEditor.Icon.CircleRed);
            Selection.activeGameObject = brakeLight;
        }
    }
예제 #2
0
    public static void CreateExhaust()
    {
        if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>())
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Ok");
        }
        else
        {
            GameObject exhaustsMain;

            if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.Find(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.name + "/Exhausts"))
            {
                exhaustsMain = new GameObject("Exhausts");
                exhaustsMain.transform.SetParent(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.transform, false);
            }
            else
            {
                exhaustsMain = Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.Find(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.name + "/Exhausts").gameObject;
            }

            GameObject exhaust = (GameObject)Instantiate(RCC_Settings.Instance.exhaustGas, Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.position, Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.rotation *Quaternion.Euler(0f, 180f, 0f));
            exhaust.name = RCC_Settings.Instance.exhaustGas.name;
            exhaust.transform.SetParent(exhaustsMain.transform);
            exhaust.transform.localPosition = new Vector3(1f, 0f, -2f);
            RCC_LabelEditor.SetIcon(exhaust, RCC_LabelEditor.Icon.DiamondGray);
            Selection.activeGameObject = exhaust;
        }
    }
예제 #3
0
    public static void CreateReverseLight()
    {
        if (SelectedCar() == null)
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Close");
        }
        else
        {
            GameObject lightsMain;

            if (!SelectedCar().transform.Find(SelectedCar().transform.name + "/Lights"))
            {
                lightsMain = new GameObject("Lights");
                lightsMain.transform.SetParent(SelectedCar().transform, false);
            }
            else
            {
                lightsMain = SelectedCar().transform.Find(SelectedCar().transform.name + "/Lights").gameObject;
            }

            GameObject reverseLight = GameObject.Instantiate(RCC_Settings.Instance.reverseLights, lightsMain.transform.position, lightsMain.transform.rotation) as GameObject;
            reverseLight.name = RCC_Settings.Instance.reverseLights.name;
            reverseLight.transform.SetParent(lightsMain.transform);
            reverseLight.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
            reverseLight.transform.localPosition = new Vector3(0f, 0f, -2f);
            RCC_LabelEditor.SetIcon(reverseLight, RCC_LabelEditor.Icon.CircleGray);
            Selection.activeGameObject = reverseLight;
        }
    }
	static void CreateMirrors () {

		if(!selectedCar.transform.GetComponentInChildren<RCC_Mirror>()){
			GameObject mirrors = (GameObject)Instantiate(RCC_Settings.Instance.mirrors, selectedCar.transform.position, selectedCar.transform.rotation);
			mirrors.transform.SetParent(selectedCar.GetComponent<RCC_CarControllerV3>().chassis.transform, true);
			mirrors.name = "Mirrors";
			RCC_LabelEditor.SetIcon(mirrors.transform.GetChild(0).gameObject, RCC_LabelEditor.Icon.DiamondRed);
			RCC_LabelEditor.SetIcon(mirrors.transform.GetChild(1).gameObject, RCC_LabelEditor.Icon.DiamondBlue);
			RCC_LabelEditor.SetIcon(mirrors.transform.GetChild(2).gameObject, RCC_LabelEditor.Icon.DiamondTeal);
			Selection.activeGameObject = mirrors;
			EditorUtility.DisplayDialog("Created Mirrors!", "Created mirrors. Adjust their positions.", "Ok");
		}else{
			EditorUtility.DisplayDialog("Vehicle Has Mirrors Already", "Vehicle has mirrors already!", "Ok");
		}
	
	}
예제 #5
0
    public static void CreateWheelCamera()
    {
        if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>())
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Ok");
        }
        else
        {
            if (Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().gameObject.GetComponentInChildren <RCCWheelCamera>())
            {
                EditorUtility.DisplayDialog("Your Vehicle Has Wheel Camera Already!", "Your vehicle has wheel camera already!", "Ok");
                Selection.activeGameObject = Selection.activeGameObject.GetComponentInChildren <RCCWheelCamera>().gameObject;
                return;
            }

            GameObject wheelCam = new GameObject("Wheel Camera");
            wheelCam.transform.SetParent(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform, false);
            wheelCam.AddComponent <RCCWheelCamera>();
            RCC_LabelEditor.SetIcon(wheelCam, RCC_LabelEditor.LabelIcon.Purple);
            Selection.activeGameObject = wheelCam;
        }
    }
예제 #6
0
    public static void CreateHoodCamera()
    {
        if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>())
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Ok");
        }
        else
        {
            if (Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().gameObject.GetComponentInChildren <RCCHoodCamera>())
            {
                EditorUtility.DisplayDialog("Your Vehicle Has Hood Camera Already!", "Your vehicle has hood camera already!", "Ok");
                Selection.activeGameObject = Selection.activeGameObject.GetComponentInChildren <RCCHoodCamera>().gameObject;
                return;
            }

            GameObject hoodCam = (GameObject)Instantiate(Resources.Load("RCCAssets/Hood Camera", typeof(GameObject)), Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.position, Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.rotation);
            hoodCam.transform.SetParent(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.transform, true);
            hoodCam.GetComponent <ConfigurableJoint>().connectedBody = Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().gameObject.GetComponent <Rigidbody>();
            RCC_LabelEditor.SetIcon(hoodCam, RCC_LabelEditor.LabelIcon.Purple);
            Selection.activeGameObject = hoodCam;
        }
    }
    public static void CreateIndicatorLight()
    {
        if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>())
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Close");
        }
        else
        {
            GameObject lightsMain;

            if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.Find(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.name + "/Lights"))
            {
                lightsMain = new GameObject("Lights");
                lightsMain.transform.SetParent(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.transform, false);
            }
            else
            {
                lightsMain = Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.Find(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.name + "/Lights").gameObject;
            }

            GameObject indicatorLight = GameObject.Instantiate(RCC_Settings.Instance.indicatorLights, lightsMain.transform.position, lightsMain.transform.rotation) as GameObject;
            Vector3    relativePos    = Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.InverseTransformPoint(indicatorLight.transform.position);
            indicatorLight.name = RCC_Settings.Instance.indicatorLights.name;
            indicatorLight.transform.SetParent(lightsMain.transform);

            if (relativePos.z > 0f)
            {
                indicatorLight.transform.localRotation = Quaternion.identity;
            }
            else
            {
                indicatorLight.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
            }

            indicatorLight.transform.localPosition = new Vector3(0f, 0f, -2f);
            RCC_LabelEditor.SetIcon(indicatorLight, RCC_LabelEditor.Icon.CircleOrange);
            Selection.activeGameObject = indicatorLight;
        }
    }
예제 #8
0
    public static void CreateHoodCamera()
    {
        if (!Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>())
        {
            EditorUtility.DisplayDialog("Select a vehicle controlled by Realistic Car Controller!", "Select a vehicle controlled by Realistic Car Controller!", "Ok");
        }
        else
        {
            if (Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().gameObject.GetComponentInChildren <RCC_HoodCamera>())
            {
                EditorUtility.DisplayDialog("Your Vehicle Has Hood Camera Already!", "Your vehicle has hood camera already!", "Ok");
                Selection.activeGameObject = Selection.activeGameObject.GetComponentInChildren <RCC_HoodCamera>().gameObject;
                return;
            }

            GameObject hoodCam = (GameObject)Instantiate(RCC_Settings.Instance.hoodCamera, Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.position, Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().transform.rotation);
            hoodCam.name = RCC_Settings.Instance.hoodCamera.name;
            hoodCam.transform.SetParent(Selection.activeGameObject.GetComponentInParent <RCC_CarControllerV3>().chassis.transform, true);
            RCC_LabelEditor.SetIcon(hoodCam, RCC_LabelEditor.LabelIcon.Purple);
            Selection.activeGameObject = hoodCam;
        }
    }
예제 #9
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        RCCCam   = (RCC_Camera)target;
        orgColor = GUI.color;

        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Main Camera designed for RCC. It includes 7 different camera modes. It doesn't use many cameras for different modes like *other* assets. Just one single camera handles them.", MessageType.Info);
        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("playerCar"), new GUIContent("Player Car", "Player Car."), false);
        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("pivot"), new GUIContent("Pivot of the Camera", "Pivot of the Camera."), false);
        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("cameraMode"), new GUIContent("Current Camera Mode", "Current Camera Modes."), false);
        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("TPS", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("TPSDistance"), new GUIContent("TPS Distance", "TPS Distance."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("TPSHeight"), new GUIContent("TPS Height", "TPS Height."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("TPSHeightDamping"), new GUIContent("TPS Height Damping", "TPS Height Damping."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("TPSRotationDamping"), new GUIContent("TPS Rotation Damping", "TPS Rotation Damping."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("TPSMinimumFOV"), new GUIContent("TPS Minimum FOV", "TPS Minimum FOV."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("TPSMaximumFOV"), new GUIContent("TPS Maximum FOV", "TPS Maximum FOV."), false);
        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("FPS", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("useHoodCameraMode"), new GUIContent("Use Hood Camera Mode", "Shall we use Hood Camera Mode?"), false);

        if (RCCCam.useHoodCameraMode)
        {
            EditorGUILayout.HelpBox("Be sure your car has ''Hood Camera''. Camera will be parented to this gameobject. You can create it from Tools --> BCG --> RCC --> Camera Systems --> Add Hood Camera.", MessageType.Info);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("hoodCameraFOV"), new GUIContent("Hood Camera FOV", "Hood Camera FOV."), false);
        }

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("Wheel", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("useWheelCameraMode"), new GUIContent("Use Wheel Camera Mode", "Shall we use Wheel Camera Mode?"), false);

        if (RCCCam.useWheelCameraMode)
        {
            EditorGUILayout.HelpBox("Be sure your car has ''Wheel Camera''. Camera will be parented to this gameobject. You can create it from Tools --> BCG --> RCC --> Camera Systems --> Add Wheel Camera.", MessageType.Info);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("wheelCameraFOV"), new GUIContent("Wheel Camera FOV", "Wheel Camera FOV."), false);
        }

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("Fixed", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("useFixedCameraMode"), new GUIContent("Use Fixed Camera Mode", "Shall we use Fixed Camera Mode?"), false);

        if (RCCCam.useFixedCameraMode)
        {
            EditorGUILayout.HelpBox("Fixed Camera is overrided by ''Fixed Camera System'' on your scene.", MessageType.Info);

            EditorGUILayout.Space();

            if (!GameObject.FindObjectOfType <RCC_FixedCamera> ())
            {
                GUI.color = Color.green;

                if (GUILayout.Button("Create Fixed Camera System"))
                {
                    GameObject fixedCamera = new GameObject("RCC_FixedCamera");
                    fixedCamera.transform.position = Vector3.zero;
                    fixedCamera.transform.rotation = Quaternion.identity;
                    fixedCamera.AddComponent <RCC_FixedCamera> ();
                    RCC_LabelEditor.SetIcon(fixedCamera, RCC_LabelEditor.LabelIcon.Orange);
                }
            }
            else
            {
                GUI.color = orgColor;

                if (GUILayout.Button("Select Fixed Camera System"))
                {
                    Selection.activeGameObject = GameObject.FindObjectOfType <RCC_FixedCamera> ().gameObject;
                }
            }

            GUI.color = orgColor;
        }

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("Cinematic", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("useCinematicCameraMode"), new GUIContent("Use Cinematic Camera Mode", "Shall we use Cinematic Camera Mode?"), false);

        if (RCCCam.useCinematicCameraMode)
        {
            EditorGUILayout.HelpBox("Cinematic Camera is overrided by ''Cinematic Camera System'' on your scene.", MessageType.Info);

            EditorGUILayout.Space();

            if (!GameObject.FindObjectOfType <RCC_CinematicCamera> ())
            {
                GUI.color = Color.green;

                if (GUILayout.Button("Create Cinematic Camera System"))
                {
                    GameObject cinematicCamera = GameObject.Instantiate(RCC_Settings.Instance.cinematicCamera, Vector3.zero, Quaternion.identity) as GameObject;
                    RCC_LabelEditor.SetIcon(cinematicCamera, RCC_LabelEditor.LabelIcon.Orange);
                }
            }
            else
            {
                GUI.color = orgColor;

                if (GUILayout.Button("Select Cinematic Camera System"))
                {
                    Selection.activeGameObject = GameObject.FindObjectOfType <RCC_CinematicCamera> ().gameObject;
                }
            }

            GUI.color = orgColor;
        }

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();
        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("Orbit", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("useOrbitCameraMode"), new GUIContent("Use Orbit Camera Mode", "Shall we use Orbit Camera Mode?"), false);

        if (RCCCam.useOrbitCameraMode)
        {
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(serializedObject.FindProperty("orbitXSpeed"), new GUIContent("Orbit X Speed", "Orbit X Speed."), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("orbitYSpeed"), new GUIContent("Orbit Y Speed", "Orbit Y Speed."), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("minOrbitY"), new GUIContent("Min Orbit Y", "Min Orbit Y."), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("maxOrbitY"), new GUIContent("Max Orbit Y", "Max Orbit Y."), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("orbitCameraFOV"), new GUIContent("Orbit Camera FOV", "Orbit Camera FOV."), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useSmoothOrbit"), new GUIContent("Use Smooth Orbit", "Use Smooth Orbit."), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useOnlyWhenHold"), new GUIContent("Use Only When Hold", "Use Only When Hold."), false);

            GUI.color = orgColor;
        }

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUILayout.LabelField("Top-Down", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("useTopCameraMode"), new GUIContent("Use Top Camera Mode", "Shall we use Top Camera Mode?"), false);

        if (RCCCam.useTopCameraMode)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useOrthoForTopCamera"), new GUIContent("Use Ortho Mode", "Use Ortho Mode."), false);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("topCameraDistance"), new GUIContent("Top Camera Distance", "Top Camera Distance"), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("topCameraAngle"), new GUIContent("Top Camera Angle", "Top Camera Angle"), false);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("maximumZDistanceOffset"), new GUIContent("Top Camera Maximum Z Distance", "Top Camera Maximum Z Distance"), false);

            if (RCCCam.useOrthoForTopCamera)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("minimumOrtSize"), new GUIContent("Minimum Ortho Size", "Minimum Ortho Size related with car speed."), false);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("maximumOrtSize"), new GUIContent("Maximum Ortho Size", "Maximum Ortho Size related with car speed."), false);
            }
            else
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("minimumOrtSize"), new GUIContent("Minimum FOV", "Minimum FOV related with car speed."), false);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("maximumOrtSize"), new GUIContent("Maximum FOV", "Maximum FOV related with car speed."), false);
            }
        }

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        GUI.color = Color.red;

        if (GUILayout.Button("Reset To Detault Settings"))
        {
            UnityEditorInternal.ComponentUtility.CopyComponent(RCC_Settings.Instance.RCCMainCamera);
            UnityEditorInternal.ComponentUtility.PasteComponentValues(RCCCam);

            RCCCam.pivot = RCCCam.transform.Find("Pivot").gameObject;
        }

        EditorGUILayout.Space();

        GUI.color = orgColor;

        serializedObject.ApplyModifiedProperties();
    }