Exemple #1
0
    public override void OnChildInspectorGUI()
    {
        //Save trigger mask to know when it chages
        triggerList = m_AkAmbient.triggerList;

        base.OnChildInspectorGUI();

        UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

        serializedObject.Update();

        UnityEngine.GUILayout.BeginVertical("Box");

        var type = m_AkAmbient.multiPositionTypeLabel;

        UnityEditor.EditorGUILayout.PropertyField(multiPositionType, new UnityEngine.GUIContent("Position Type: "));

        UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

        currentAttSphereOp =
            (AttenuationSphereOptions)UnityEditor.EditorGUILayout.EnumPopup("Show Attenuation Sphere: ", currentAttSphereOp);

        UnityEngine.GUILayout.EndVertical();

        //Save multi-position type to know if it has changed
        var multiPosType = m_AkAmbient.multiPositionTypeLabel;

        serializedObject.ApplyModifiedProperties();

        if (m_AkAmbient.multiPositionTypeLabel == MultiPositionTypeLabel.MultiPosition_Mode)
        {
            //Here we make sure all AkAmbients that are in multi-position mode and that have the same event also have the same trigger
            UpdateTriggers(multiPosType);
        }

        if (UnityEngine.GUI.changed)
        {
            if (type != m_AkAmbient.multiPositionTypeLabel)
            {
                if (m_AkAmbient.multiPositionTypeLabel != MultiPositionTypeLabel.Large_Mode)
                {
                    m_AkAmbient.multiPositionArray.Clear();

                    // TODO: I need a good method to update the array in edit mode
                    //m_AkAmbient.BuildMultiDirectionArray();
                }
            }
        }
    }
    public override void OnChildInspectorGUI()
    {
        //Save trigger mask to know when it chages
        triggerList = m_AkAmbient.triggerList;

        base.OnChildInspectorGUI ();

        GUILayout.Space (3);

        serializedObject.Update ();

        GUILayout.BeginVertical("Box");

        MultiPositionTypeLabel type = m_AkAmbient.multiPositionTypeLabel;

        EditorGUILayout.PropertyField(multiPositionType, new GUIContent("Position Type: "));

        GUILayout.Space (2);

        currentAttSphereOp = (AttenuationSphereOptions)EditorGUILayout.EnumPopup("Show Attenuation Sphere: ", currentAttSphereOp);

        GUILayout.EndVertical();

        //Save multi-position type to know if it has changed
        MultiPositionTypeLabel multiPosType = m_AkAmbient.multiPositionTypeLabel;

        serializedObject.ApplyModifiedProperties ();

        if(m_AkAmbient.multiPositionTypeLabel == MultiPositionTypeLabel.MultiPosition_Mode)
        {
            //Here we make sure all AkAmbients that are in multi-position mode and that have the same event also have the same trigger
            UpdateTriggers(multiPosType);
        }

        if (GUI.changed)
        {
            if (type != m_AkAmbient.multiPositionTypeLabel)
            {
                if (m_AkAmbient.multiPositionTypeLabel != MultiPositionTypeLabel.Large_Mode)
                {
                    m_AkAmbient.multiPositionArray.Clear();

                    // TODO: I need a good method to update the array in edit mode
                    //m_AkAmbient.BuildMultiDirectionArray();
                }
            }
        }
    }
    private new void OnEnable()
    {
        base.OnEnable();

        m_AkAmbient = target as AkAmbient;

        multiPositionType     = serializedObject.FindProperty("multiPositionTypeLabel");
        DefaultHandles.Hidden = hideDefaultHandle;

        if (!attSphereProperties.ContainsKey(target))
        {
            attSphereProperties.Add(target, AttenuationSphereOptions.Dont_Show);
        }

        currentAttSphereOp = attSphereProperties[target];

        AkWwiseXMLWatcher.Instance.XMLUpdated += PopulateMaxAttenuation;
    }
	new void OnEnable()
	{
		base.OnEnable ();

		m_AkAmbient = target as AkAmbient; 

		multiPositionType = serializedObject.FindProperty("multiPositionTypeLabel");
		DefaultHandles.Hidden = hideDefaultHandle;

		if(!attSphereProperties.ContainsKey(target.GetInstanceID()))
			attSphereProperties.Add(target.GetInstanceID(), AttenuationSphereOptions.Dont_Show);
	
		currentAttSphereOp = attSphereProperties [target.GetInstanceID ()];

		AkWwiseXMLWatcher.GetInstance ().StartXMLWatcher ();

		EditorApplication.update += PopulateMaxAttenuation;
	}
Exemple #5
0
    public new void OnEnable()
    {
        base.OnEnable();

        m_AkAmbient = target as AkAmbient;

        multiPositionTypeProperty      = serializedObject.FindProperty("multiPositionTypeLabel");
        largeModePositionArrayProperty = serializedObject.FindProperty("LargeModePositions");

        if (!attSphereProperties.ContainsKey(target))
        {
            attSphereProperties.Add(target, AttenuationSphereOptions.Dont_Show);
        }

        currentAttSphereOp = attSphereProperties[target];

        AkWwiseXMLWatcher.Instance.XMLUpdated += PopulateMaxAttenuation;
    }
    public override void OnChildInspectorGUI()
    {
        //Save trigger mask to know when it changes
        triggerList = m_AkAmbient.triggerList;

        base.OnChildInspectorGUI();

        UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

        serializedObject.Update();

        var type = m_AkAmbient.multiPositionTypeLabel;

        using (new UnityEditor.EditorGUILayout.VerticalScope("box"))
        {
            UnityEditor.EditorGUILayout.PropertyField(multiPositionType, new UnityEngine.GUIContent("Position Type: "));

            UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

            currentAttSphereOp =
                (AttenuationSphereOptions)UnityEditor.EditorGUILayout.EnumPopup("Show Attenuation Sphere: ", currentAttSphereOp);
        }

        //Save multi-position type to know if it has changed
        var multiPosType = m_AkAmbient.multiPositionTypeLabel;

        serializedObject.ApplyModifiedProperties();

        if (m_AkAmbient.multiPositionTypeLabel == MultiPositionTypeLabel.MultiPosition_Mode)
        {
            UpdateTriggers(multiPosType);
        }

        if (UnityEngine.GUI.changed)
        {
            if (type != m_AkAmbient.multiPositionTypeLabel &&
                m_AkAmbient.multiPositionTypeLabel != MultiPositionTypeLabel.Large_Mode)
            {
                m_AkAmbient.multiPositionArray.Clear();
            }
        }
    }
Exemple #7
0
    private new void OnEnable()
    {
        base.OnEnable();

        m_AkAmbient = target as AkAmbient;

        multiPositionType     = serializedObject.FindProperty("multiPositionTypeLabel");
        DefaultHandles.Hidden = hideDefaultHandle;

        if (!attSphereProperties.ContainsKey(target.GetInstanceID()))
        {
            attSphereProperties.Add(target.GetInstanceID(), AttenuationSphereOptions.Dont_Show);
        }

        currentAttSphereOp = attSphereProperties[target.GetInstanceID()];

        AkWwiseXMLWatcher.GetInstance().StartXMLWatcher();

        UnityEditor.EditorApplication.update += PopulateMaxAttenuation;
    }
Exemple #8
0
    public override void OnChildInspectorGUI()
    {
        //Save trigger mask to know when it changes
        triggerList = m_AkAmbient.triggerList;

        base.OnChildInspectorGUI();

        if (UnityEngine.Event.current.type == UnityEngine.EventType.ExecuteCommand &&
            UnityEngine.Event.current.commandName == "ObjectSelectorClosed")
        {
            var pickedObject = UnityEditor.EditorGUIUtility.GetObjectPickerObject();
            if (pickedObject != null)
            {
                int insertIndex = largeModePositionArrayProperty.arraySize;
                largeModePositionArrayProperty.InsertArrayElementAtIndex(insertIndex);

                var newElement = largeModePositionArrayProperty.GetArrayElementAtIndex(insertIndex);
                newElement.objectReferenceValue = pickedObject;
                return;
            }
        }

        UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

        using (new UnityEditor.EditorGUILayout.VerticalScope("box"))
        {
            UnityEditor.EditorGUILayout.PropertyField(multiPositionTypeProperty, new UnityEngine.GUIContent("Position Type: ", "Simple Mode: Only one position is used.\nLarge Mode: Children of AkAmbient with AkAmbientLargeModePositioner component will be used as position source for multi-positioning.\nMultiple Position Mode: Every AkAmbient using the same event will be used as position source for multi-positioning."));

            UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

            currentAttSphereOp          = (AttenuationSphereOptions)UnityEditor.EditorGUILayout.EnumPopup("Show Attenuation Sphere: ", currentAttSphereOp);
            attSphereProperties[target] = currentAttSphereOp;

            if (multiPositionTypeProperty.intValue == (int)MultiPositionTypeLabel.Large_Mode)
            {
                UnityEngine.GUILayout.BeginHorizontal();
                if (UnityEngine.GUILayout.Button("Add Large Mode position object"))
                {
                    int insertIndex = largeModePositionArrayProperty.arraySize;
                    largeModePositionArrayProperty.InsertArrayElementAtIndex(insertIndex);

                    UnityEngine.GameObject newPoint = new UnityEngine.GameObject(string.Format("AkAmbientPoint{0}", insertIndex));
                    UnityEditor.Undo.RegisterCreatedObjectUndo(newPoint, "CreateNewLargeModePositionObject");
                    UnityEditor.Undo.AddComponent <AkAmbientLargeModePositioner>(newPoint);
                    UnityEditor.Undo.SetTransformParent(newPoint.transform, m_AkAmbient.transform, "CreateNewLargeModePositionObjectSetParent");
                    newPoint.transform.position   = m_AkAmbient.transform.TransformPoint(UnityEngine.Vector3.zero);
                    newPoint.transform.localScale = new UnityEngine.Vector3(1f, 1f, 1f);

                    var newElement = largeModePositionArrayProperty.GetArrayElementAtIndex(insertIndex);
                    newElement.objectReferenceValue = newPoint.GetComponent <AkAmbientLargeModePositioner>();
                }

                if (UnityEngine.GUILayout.Button("Pick existing position object"))
                {
                    int controlID = UnityEngine.GUIUtility.GetControlID(UnityEngine.FocusType.Passive);
                    UnityEditor.EditorGUIUtility.ShowObjectPicker <AkAmbientLargeModePositioner>(null, true, string.Empty, controlID);
                }
                UnityEngine.GUILayout.EndHorizontal();

                ++UnityEditor.EditorGUI.indentLevel;
                UnityEditor.EditorGUI.BeginChangeCheck();
                for (int i = 0; i < largeModePositionArrayProperty.arraySize; ++i)
                {
                    UnityEditor.EditorGUILayout.PropertyField(largeModePositionArrayProperty.GetArrayElementAtIndex(i), true);
                }
                if (UnityEditor.EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                --UnityEditor.EditorGUI.indentLevel;
            }
        }

        //Save multi-position type to know if it has changed
        var multiPosType = m_AkAmbient.multiPositionTypeLabel;

        if (m_AkAmbient.multiPositionTypeLabel == MultiPositionTypeLabel.MultiPosition_Mode)
        {
            UpdateTriggers(multiPosType);
        }
    }