コード例 #1
0
        public override bool Activate(CogTriggerSource source, CommonTargetAction action, TriggerData triggerData)
        {
            if (action == CommonTargetAction.Activate)
            {
                this.EnableTarget.enabled = true;
                return(true);
            }
            else if (action == CommonTargetAction.Deactivate)
            {
                this.EnableTarget.enabled = false;
                return(true);
            }
            else if (action == CommonTargetAction.Toggle)
            {
                this.EnableTarget.enabled = !this.EnableTarget.enabled;
                return(true);
            }

            return(false);
        }
コード例 #2
0
        public override bool Activate(CogTriggerSource source, CommonTargetAction action, TriggerData triggerData)
        {
            if (action == CommonTargetAction.Open || action == CommonTargetAction.Activate)
            {
                if (mState == State.Closed || mState == State.Closing)
                {
                    GoToOpening();
                    return(true);
                }
            }
            else if (action == CommonTargetAction.Close && this.AllowCloseByTrigger)
            {
                if (mState != State.Closed || mState != State.Closing)
                {
                    GoToClosing();
                    return(true);
                }
            }

            return(false);
        }
コード例 #3
0
        public override bool Activate(CogTriggerSource source, CommonTargetAction action, TriggerData triggerData)
        {
            if (action == CommonTargetAction.Activate || action == CommonTargetAction.DefaultActivation)
            {
                var groupId = triggerData.NamedProperties.FirstOrDefault(o => o.Key.Equals(GroupIdNamedProp));
                var subId   = triggerData.NamedProperties.FirstOrDefault(o => o.Key.Equals(SubIdNamedProp));

                // Cannot execute without appropriate parameters
                if (groupId == null || subId == null)
                {
                    return(false);
                }

                var msg = new GenericMessage(groupId.Value, subId.Value);
                msg.ObjectData = triggerData.UnityTransformData;
                msg.StringData = triggerData.StringData;

                var hook = GlobalObjectsUtility.FromStateHook <BaseStateHook>();
                hook.GameMessageRouter.Send(this.ChannelId, msg);
                return(true);
            }

            return(false);
        }
コード例 #4
0
        public CommonTargetAction DefaultActionOnLink;           // Which action we should take when dynamically linking a source to this target.

        /// <summary>
        /// Activates the trigger with the specified action.
        /// </summary>
        /// <returns>True if the activation was successful</returns>
        public abstract bool Activate(CogTriggerSource source, CommonTargetAction action, TriggerData triggerData);