コード例 #1
0
        /// <summary>
        /// Processes the given publisher data.
        /// </summary>
        /// <param name="publisher">The publisher to process.</param>
        /// <param name="previousIdentifier">The previous publisher's identifier.</param>
        /// <param name="previousActionType">The previous publisher's action type.</param>
        protected virtual void ProcessPublisher(InteractorActionPublisherFacade publisher, ref string previousIdentifier, ref Type previousActionType)
        {
            Type publisherActionType = publisher.ActiveAction.GetType();

            IsValidPublisherElement(previousIdentifier, publisher.PublisherIdentifier, string.Format("All `SourcePublishers` identifiers must be identical. Mismatch found between previous value of `{0}` and the publisher `{1}` which has a value of `{2}`.", previousIdentifier, publisher.name, publisher.PublisherIdentifier));
            IsValidPublisherElement(previousActionType, publisherActionType, string.Format("All `SourcePublishers` Action types must be identical. Mismatch found between previous value of `{0}` and the publisher `{1}` which has a value of `{2}`.", previousActionType, publisher.name, publisherActionType));

            ActivateOutputAction(publisherActionType);
            SetupPublisherLinks(publisher);

            previousIdentifier = publisher.PublisherIdentifier;
            previousActionType = publisherActionType;
        }
コード例 #2
0
        /// <summary>
        /// Sets up the links from the publisher to the receiver.
        /// </summary>
        /// <param name="publisher">The publisher to link to.</param>
        protected virtual void SetupPublisherLinks(InteractorActionPublisherFacade publisher)
        {
            ActionRegistrar.ActionSource actionSource = new ActionRegistrar.ActionSource()
            {
                Enabled   = false,
                Container = publisher.SourceInteractor.gameObject,
                Action    = publisher.ActiveAction
            };

            ActionRegistrar.Sources.Add(actionSource);

            ReceiveStartActionStringRule.InListPattern = string.Format("^Start{0}$", publisher.PublisherIdentifier);
            ReceiveStopActionStringRule.InListPattern  = string.Format("^Stop{0}$", publisher.PublisherIdentifier);
        }