예제 #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        bzScript = (SAICBrakeZonesContainer)target;

        if(GUILayout.Button("Delete Brake Zones")){
            foreach(Transform t in bzScript.brakeZones){
                DestroyImmediate(t.gameObject);
            }
            bzScript.brakeZones.Clear();
        }

        EditorGUILayout.PropertyField(serializedObject.FindProperty("brakeZones"), new GUIContent("Brake Zones", "Brake Zones"), true);

        EditorGUILayout.HelpBox("Create BrakeZones By Shift + Left Mouse Button On Your Road", MessageType.Info);

        serializedObject.ApplyModifiedProperties();
    }
예제 #2
0
    public override void  OnInspectorGUI()
    {
        serializedObject.Update();

        bzScript = (SAICBrakeZonesContainer)target;

        if (GUILayout.Button("Delete Brake Zones"))
        {
            foreach (Transform t in bzScript.brakeZones)
            {
                DestroyImmediate(t.gameObject);
            }
            bzScript.brakeZones.Clear();
        }

        EditorGUILayout.PropertyField(serializedObject.FindProperty("brakeZones"), new GUIContent("Brake Zones", "Brake Zones"), true);

        EditorGUILayout.HelpBox("Create BrakeZones By Shift + Left Mouse Button On Your Road", MessageType.Info);

        serializedObject.ApplyModifiedProperties();
    }
예제 #3
0
    void OnSceneGUI()
    {
        Event e = Event.current;

        bzScript = (SAICBrakeZonesContainer)target;

        if (e != null)
        {
            if (e.isMouse && e.shift && e.type == EventType.MouseDown)
            {
                Ray        ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                RaycastHit hit = new RaycastHit();
                if (Physics.Raycast(ray, out hit, 5000.0f))
                {
                    Vector3 newTilePosition = hit.point;

                    GameObject wp = new GameObject("Brake Zone " + bzScript.brakeZones.Count.ToString());

                    wp.transform.position = newTilePosition;
                    wp.AddComponent <SAICBrakeZone>();
                    wp.AddComponent <BoxCollider>();
                    wp.GetComponent <BoxCollider>().isTrigger = true;
                    wp.GetComponent <BoxCollider>().size      = new Vector3(25, 10, 50);
                    wp.transform.SetParent(bzScript.transform);
                    GetBrakeZones();
                    Event.current.Use();
                }
            }

            if (bzScript)
            {
                Selection.activeGameObject = bzScript.gameObject;
            }
        }

        GetBrakeZones();
    }
예제 #4
0
    void OnSceneGUI()
    {
        Event e = Event.current;
        bzScript = (SAICBrakeZonesContainer)target;

        if(e != null){

            if(e.isMouse && e.shift && e.type == EventType.MouseDown){

                Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                RaycastHit hit = new RaycastHit();
                if (Physics.Raycast(ray, out hit, 5000.0f)) {

                    Vector3 newTilePosition = hit.point;

                    GameObject wp = new GameObject("Brake Zone " + bzScript.brakeZones.Count.ToString());

                    wp.transform.position = newTilePosition;
                    wp.AddComponent<SAICBrakeZone>();
                    wp.AddComponent<BoxCollider>();
                    wp.GetComponent<BoxCollider>().isTrigger = true;
                    wp.GetComponent<BoxCollider>().size = new Vector3(25, 10, 50);
                    wp.transform.SetParent(bzScript.transform);
                    GetBrakeZones();
                    Event.current.Use();

                }

            }

            if(bzScript)
                Selection.activeGameObject = bzScript.gameObject;

        }

        GetBrakeZones();
    }