Пример #1
0
        /// <summary>
        /// Updates the associated clip information and the event durations.
        /// </summary>
        /// <returns>Returns true if the Wwise event is found in the project data.</returns>
        private static bool UpdateClipInformation(UnityEngine.Timeline.TimelineClip clip, AK.Wwise.Event akEvent,
                                                  UnityEditor.SerializedObject serializedObject, bool setClipDuration)
        {
            var clipDuration = MinimumDurationInSeconds;
            var maxDuration  = -1.0f;
            var minDuration  = -1.0f;

            AkUtilities.GetEventDurations(akEvent.Id, ref maxDuration, ref minDuration);
            if (maxDuration != -1.0f)
            {
                serializedObject.FindProperty("eventDurationMin").floatValue = minDuration;
                serializedObject.FindProperty("eventDurationMax").floatValue = maxDuration;

                if (maxDuration > clipDuration)
                {
                    clipDuration = maxDuration;
                }
            }

            if (clip != null)
            {
                clip.displayName = akEvent.Name;
                if (setClipDuration)
                {
                    clip.duration = clipDuration;
                }
            }

            return(maxDuration != -1.0f);
        }