Example #1
0
        protected virtual void Update()
        {
            if (m_entity != null && m_renderer != null)
            {
                m_renderer.enabled = m_entity.Data.bodyVisible;

                m_entityPosition = m_entity.Position();
                Vector3 pos = m_context.EntityToViewPoint(m_entityPosition);
                this.transform.localPosition    = pos;
                this.transform.localEulerAngles = m_entity.EulerAngles;
                float viewScale = m_entity.Data.viewScale;
                this.transform.localScale = new Vector3(viewScale, viewScale, 1f);
                //this.transform.rotation = m_Model.Rotation;
            }
        }
Example #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);
        }
Example #3
0
        private void Blast()
        {
            SnakeNode node = m_head;

            while (node != null)
            {
                if (node.IsKeyNode())
                {
                    Vector3 pos = GetRandomPosition(node.Position(), 8);

                    node.Blast();

                    if (GameManager.Instance.Context.random.Rnd() > 0.5)
                    {
                        GameManager.Instance.AddFood(pos, m_data.teamId);
                    }
                }

                node = node.Next;
            }
        }