Example #1
0
        /// <summary>
        ///     进入了点开卡片的影响范围
        /// </summary>
        /// <param name="kinectAgent"></param>
        /// <returns></returns>
        public bool HasEnterCardRange(KinectAgent kinectAgent)
        {
            var screenPosition = kinectAgent.GetRefPosition();
            var position       = Camera.main.ScreenToWorldPoint(screenPosition);


            bool hasEnter = false;

            for (int i = 0; i < _manager.operateCardManager.EffectAgents.Count; i++)
            {
                var agent    = _manager.operateCardManager.EffectAgents[i];
                var distance = Vector2.Distance(agent.transform.position, position);
                if (distance < safeDistance)
                {
                    hasEnter = true;
                }
            }

            return(hasEnter);
        }
Example #2
0
        /// <summary>
        ///     进入了体感卡片的影响范围
        /// </summary>
        /// <param name="kinectAgent"></param>
        /// <returns></returns>
        public KinectAgent HasEnterKinectCardRange(KinectAgent kinectAgent)
        {
            var screenPosition = kinectAgent.GetRefPosition();
            var position       = Camera.main.ScreenToWorldPoint(screenPosition);

            KinectAgent targetKinectAgent = null;

            for (int i = 0; i < _kinectAgents.Count; i++)
            {
                var agent = _kinectAgents[i];

                if ((agent.userId != kinectAgent.userId) && agent.status == KinectAgentStatusEnum.Normal)
                {
                    var distance = Vector2.Distance(agent.transform.position, position);
                    if (distance < safeDistance)
                    {
                        targetKinectAgent = agent;
                    }
                }
            }

            return(targetKinectAgent);
        }