コード例 #1
0
        /*! \endcond */


        /// <summary>
        /// This method is used to create a Custom Event at runtime.
        /// </summary>
        /// <param name="customEventName">The name of the custom event.</param>
        /// <param name="eventReceiveMode">The receive mode of the event.</param>
        /// <param name="distanceThreshold">The min or max distance to transmit the event to (optional).</param>
        /// <param name="errorOnDuplicate">Whether or not to log an error if the event already exists.</param>
        public static void CreateCustomEvent(string customEventName, CustomEventReceiveMode eventReceiveMode,
            float distanceThreshold, bool errorOnDuplicate = true) {
            if (AppIsShuttingDown) {
                return;
            }

            if (Instance.customEvents.FindAll(delegate(CustomEvent obj) {
                return obj.EventName == customEventName;
            }).Count > 0) {
                if (errorOnDuplicate) {
                    Debug.LogError("You already have a Custom Event named '" + customEventName +
                                   "'. No need to add it again.");
                }
                return;
            }

            var newEvent = new CustomEvent(customEventName) {
                eventReceiveMode = eventReceiveMode,
                distanceThreshold = distanceThreshold
            };

            Instance.customEvents.Add(newEvent);
        }
コード例 #2
0
ファイル: MasterAudio.cs プロジェクト: kielgasten/ZenDemoer
    /// <summary>
    /// This method is used to create a Custom Event at runtime.
    /// </summary>
    /// <param name="customEventName">The name of the custom event.</param>
    public static void CreateCustomEvent(string customEventName, CustomEventReceiveMode eventReceiveMode, float distanceThreshold)
    {
        if (AppIsShuttingDown) {
            return;
        }

        if (MasterAudio.Instance.customEvents.FindAll(delegate(CustomEvent obj) {
            return obj.EventName == customEventName;
        }).Count > 0) {
            Debug.LogError("You already have a Custom Event named '" + customEventName + "'. No need to add it again.");
            return;
        }

        var newEvent = new CustomEvent(customEventName);
        newEvent.eventReceiveMode = eventReceiveMode;
        newEvent.distanceThreshold = distanceThreshold;

        MasterAudio.Instance.customEvents.Add(newEvent);
    }