Exemplo n.º 1
0
    private void Compile(InputBuildContext context)
    {
        context.info.compilerCount++;

        ConnectionSetCompiler compiler = context.connCompiler;
        List <Component>      items    = context.components;
        List <byte>           areas    = context.areas;

        int count = 0;

        for (int i = 0; i < items.Count; i++)
        {
            Component item = items[i];

            if (item is OFMConnection)
            {
                OFMConnection conn = (OFMConnection)item;
                byte          area = (conn.OverrideArea ? conn.Area : areas[i]);

                compiler.Add(conn.StartPoint.ToVector3(), conn.EndPoint.ToVector3()
                             , conn.Radius
                             , conn.IsBidirectional
                             , area
                             , conn.Flags
                             , (uint)conn.UserId);

                count++;
            }
        }

        context.Log(string.Format("Compiled off-mesh connections: {0}", count), this);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Controls behavior of the inspector.
    /// </summary>
    public override void OnInspectorGUI()
    {
        OFMConnection targ = (OFMConnection)target;

        EditorGUILayout.Separator();

        bool changed = GUI.changed;

        NMGenComponent.debugEnabled =
            EditorGUILayout.Toggle("Show All", NMGenComponent.debugEnabled);

        if (GUI.changed)
        {
            SceneView.RepaintAll();
        }

        GUI.changed = changed;

        // EditorGUILayout.Separator();
        // targ.End = (Transform)EditorGUILayout.ObjectField("Endpoint", targ.End, typeof(Transform), true);

        EditorGUILayout.Separator();

        targ.Radius = EditorGUILayout.FloatField("Radius", targ.Radius);
        targ.UserId = EditorGUILayout.IntField("User Id", targ.UserId);

        targ.Flags = (ushort)EditorGUILayout.MaskField("Flags", targ.Flags, mFlagNames);

        targ.IsBidirectional = EditorGUILayout.Toggle("Bidirectional", targ.IsBidirectional);

        EditorGUILayout.Separator();

        targ.OverrideArea = EditorGUILayout.Toggle("Override Area", targ.OverrideArea);

        GUI.enabled = targ.OverrideArea;

        if (GUI.enabled)
        {
            targ.Area = mAreaControl.OnGUI(targ.Area);
        }
        else
        {
            EditorGUILayout.LabelField("Area", "Build Default");
        }

        GUI.enabled = true;

        EditorGUILayout.Separator();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 3
0
    static void CreateGameObject()
    {
        GameObject go = new GameObject("OffMeshConn");

        go.transform.position = EditorUtil.GetCreatePosition();

        OFMConnection comp = go.AddComponent <OFMConnection>();

        comp.EndPoint = go.transform.position + Vector3.up + Vector3.right + Vector3.forward;

        Selection.activeGameObject = go;
    }
Exemplo n.º 4
0
    static void DrawGizmo(OFMConnection marker, GizmoType type)
    {
        if (!NMGenComponent.debugEnabled && (type & GizmoType.InSelectionHierarchy) == 0)
        {
            return;
        }

        Gizmos.color = ColorUtil.IntToColor(marker.Area, 0.6f);

        Gizmos.DrawCube(marker.transform.position, markerSize);
        Gizmos.DrawCube(marker.EndPoint, markerSize);
    }
Exemplo n.º 5
0
    void OnSceneGUI()
    {
        OFMConnection targ = (OFMConnection)target;


        targ.EndPoint = Handles.PositionHandle(targ.EndPoint, Quaternion.identity);

        if (Input.GetMouseButtonDown(0))
        {
            Undo.RecordObject(target, "Endpoint move.");
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(targ);
        }
    }
Exemplo n.º 6
0
    static void DrawGizmo(OFMConnection marker, GizmoType type)
    {
        if (!NMGenComponent.debugEnabled && (type & GizmoType.InSelectionHierarchy) == 0)
            return;

        Gizmos.color = ColorUtil.IntToColor(marker.Area, 0.6f);

        Gizmos.DrawCube(marker.transform.position, markerSize);
        Gizmos.DrawCube(marker.EndPoint, markerSize);
    }