Beispiel #1
0
 protected virtual void OnPlaneUpdated(ARKPlane _plane)
 {
     if (m_planePrefab)
     {
         CreateOrUpdatePlaneGameObject(_plane);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Method used to do a safe call of the 'onPlaneRemoved' delegate.
 /// </summary>
 protected void OnPlaneRemoved(ARKPlane _plane)
 {
     if (onPlaneRemoved != null)
     {
         onPlaneRemoved(_plane);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Method used to do a safe call of the 'onPlaneUpdated' delegate.
 /// </summary>
 protected void OnPlaneUpdated(ARKPlane _plane)
 {
     if (onPlaneUpdated != null)
     {
         onPlaneUpdated(_plane);
     }
 }
Beispiel #4
0
        protected virtual void OnPlaneRemoved(ARKPlane _plane)
        {
            GameObject go;

            if (m_planes.TryGetValue(_plane.id, out go))
            {
                Destroy(go);
                m_planes.Remove(_plane.id);
            }
        }
Beispiel #5
0
        protected virtual void CreateOrUpdatePlaneGameObject(ARKPlane _plane)
        {
            GameObject go;

            if (!m_planes.TryGetValue(_plane.id, out go))
            {
                go = Instantiate(m_planePrefab, GetRoot());

                //Viewer contains colliders, we need to assign the correct layer for Raycasts
                foreach (var col in go.GetComponentsInChildren <Collider>())
                {
                    col.gameObject.layer = m_planeLayer;
                }

                m_planes.Add(_plane.id, go);
            }

            go.transform.localPosition = _plane.center;
            go.transform.localRotation = _plane.rotation;
            go.transform.localScale    = new Vector3(_plane.extents.x, 1f, _plane.extents.y);
        }