示例#1
0
        public void Start()
        {
            mCooldownTimer = new CooldownTimer(this.CooldownTime);
            var hook = GlobalObjectsUtility.FromStateHook <BaseStateHook>();

            hook.GameMessageRouter.AddListener(Common.Messaging.GameChannel, this);
        }
示例#2
0
        public void OnMouseDown()
        {
            mMouseDownSelected = true;
            mMouseDownPt       = UnityEngine.Input.mousePosition;
            var hook = GlobalObjectsUtility.FromStateHook <BaseStateHook>();

            hook.GameMessageRouter.Send(Common.Messaging.GameChannel,
                                        new GenericMessage(Common.Messaging.GameChannel, Common.Messaging.MouseDownEventSubId)
            {
                ObjectData = this
            });
        }
        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);
        }