Example #1
0
        // -------------------------------------------

        /*
         * Update the quaternion information
         */
        void Update()
        {
            if (m_forward != null)
            {
                m_clientPosition.text = "[" + ((Vector3)m_forward.GetValue()).ToString() + "]";
            }
        }
Example #2
0
        // -------------------------------------------

        /*
         * BuildLine
         */
        private string BuildLine(List <Vector2> _pointsLine, bool _clearPoints)
        {
            Vector3 forward       = DISTANCE_FROM_CAMERA_TO_DRAW * (Vector3)m_forwardPlayer.GetValue();
            Vector3 finalPosition = Vector3.zero + forward;

            string messageVertex = "" + YourNetworkTools.Instance.GetUniversalNetworkID() + CHAR_SEPARATOR + m_counterLinesPainted + CHAR_SEPARATOR + m_colorSelected + CHAR_ENDOFLINE;

            messageVertex += "" + forward.x + CHAR_SEPARATOR + forward.y + CHAR_SEPARATOR + forward.z + CHAR_ENDOFLINE;
            messageVertex += "" + finalPosition.x + CHAR_SEPARATOR + finalPosition.y + CHAR_SEPARATOR + finalPosition.z + CHAR_ENDOFLINE;
            for (int i = 0; i < _pointsLine.Count; i++)
            {
                Vector2 pos     = _pointsLine[i];
                float   factorX = (0.23f * (float)Screen.width);
                float   factorY = 0.38f * (float)Screen.height;
                float   xPos    = (pos.x - (Screen.width / 2)) / factorX;
                float   yPos    = (pos.y - (Screen.height / 2)) / factorY;
                messageVertex += "" + xPos + CHAR_SEPARATOR + yPos;
                if (i + 1 < _pointsLine.Count)
                {
                    messageVertex += CHAR_ENDOFLINE;
                }
            }
            if (_clearPoints)
            {
                _pointsLine.Clear();
            }

            return(messageVertex);
        }