Ejemplo n.º 1
0
        // ---- Unity events

        void Awake()
        {
            m_Instance = this;

            Debug.Assert(m_MaxPointers > 0);
            m_Pointers = new PointerData[m_MaxPointers];

            for (int i = 0; i < m_Pointers.Length; ++i)
            {
                //set our main pointer as the zero index
                bool       bMain = (i == 0);
                var        data  = new PointerData();
                GameObject obj   = (GameObject)Instantiate(bMain ? m_MainPointerPrefab : m_AuxPointerPrefab);
                obj.transform.parent = transform;
                data.m_Script        = obj.GetComponent <PointerScript>();
                data.m_Script.EnableDebugViewControlPoints(bMain && m_DebugViewControlPoints);
                data.m_Script.ChildIndex = i;
                data.m_UiEnabled         = bMain;
                m_Pointers[i]            = data;
                if (bMain)
                {
                    m_MainPointerData = data;
                }
            }

            m_CurrentLineCreationState = LineCreationState.WaitingForInput;
            m_StraightEdgeProxyActive  = false;
            m_StraightEdgeGesture      = new CircleGesture();

            if (m_SymmetryWidget)
            {
                m_SymmetryWidgetScript = m_SymmetryWidget.GetComponent <SymmetryWidget>();
            }

            //initialize rendering requests to default to hiding everything
            m_PointersRenderingRequested = false;
            m_PointersRenderingActive    = true;

            m_FreePaintPointerAngle =
                PlayerPrefs.GetFloat(PLAYER_PREFS_POINTER_ANGLE, m_DefaultPointerAngle);
        }