示例#1
0
        public bool TryHitEnemies(List <SnakePlayer> listPlayers)
        {
            for (int j = 0; j < listPlayers.Count; j++)
            {
                SnakePlayer other = listPlayers[j];
                if (this != other)
                {
                    if (HitTest(other, HitDistance))
                    {
                        Blast();
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#2
0
        public bool HitTest(SnakePlayer player, float testDistance)
        {
            SnakeNode node = player.Head;

            while (node != null)
            {
                if (node.IsKeyNode())
                {
                    float distance = Vector3.Distance(m_head.Position(), node.Position());
                    if (distance < testDistance)
                    {
                        return(true);
                    }
                }

                node = node.Next;
            }

            return(false);
        }