public void Animate()
 {
     _bounds            = ForgeImport.GameObjectBounds(_root);
     _rotationActivated = true;
     //if ( _rotationCoR != null )
     //	return ;
     //_rotationCoR =StartCoroutine (RotateObject.Instance.Rotation (_root.transform, new Vector3 (0f, 180f, 0f), 5f)) ;
     ////_rotationCoR =StartCoroutine (RotateObject.Instance.Rotation (_root.transform, new Vector3 (0f, 0f, 0f), 5f)) ;
 }
示例#2
0
        protected void OnDrawGizmosSelected()
        {
            //if ( GetComponent<MeshFilter> () == null )
            //	return ;
            //Bounds b =GetComponent<MeshFilter> ().sharedMesh.bounds ;
            //Gizmos.color =_color ;
            //Gizmos.DrawWireCube (transform.position + b.center, 2 * b.extents) ;

            Bounds b = ForgeImport.GameObjectBounds(this.gameObject);

            Gizmos.color = _color;
            Gizmos.DrawWireCube(b.center, 2 * b.extents);
        }
        public IEnumerator Scale(Transform thisTransform, Vector3 startScale, Vector3 endScale, float value, ScaleObject.ScaleType moveType)
        {
            float rate = (moveType == ScaleObject.ScaleType.Time) ? 1.0f / value : 1.0f / Vector3.Distance(startScale, endScale) * value;
            float t    = 0.0f;

            while (t < 1.0)
            {
                t += Time.deltaTime * rate;
                thisTransform.localScale = Vector3.Lerp(startScale, endScale, Mathf.SmoothStep(0.0f, 1.0f, t));
                Bounds bounds = ForgeImport.GameObjectBounds(thisTransform.gameObject);
                thisTransform.position += (_bounds.center - bounds.center);
                yield return(null);
            }
        }
示例#4
0
        protected void ImportBubble()
        {
            _name = _name.Trim();
            if (string.IsNullOrEmpty(_name))
            {
                EditorUtility.DisplayDialog("Unable to import", "Please specify a valid project name.", "Close");
                return;
            }
            ForgeImport.ProcessedNodes += new ForgeImport.ProcessedNodesDelegate(ProcessedNodes);
            ForgeImport.CreateAssets(_name, _autoScale, _folder + _svf [_svfIndex], _folder + _db);

            EditorUtility.ClearProgressBar();
            this.Repaint();
            CloseDialog();
        }
        public void Floor()
        {
            Bounds  bounds = ForgeImport.GameObjectBounds(_root);
            Vector3 bottom = bounds.center - new Vector3(0f, bounds.size.y / 2f, 0f);
            float   offset = -1.5f - bottom.y;

            _root.transform.localPosition += new Vector3(0f, offset, 0f);

            //_root.transform.localPosition =new Vector3 (0f, -1.5f, 0f)
            //	+ new Vector3 (0f, bounds.extents.y, 0f) ;
            //_root.transform.localPosition +=new Vector3 (
            //	0f,
            //	_root.transform.localPosition.y - 1.5f + bounds.extents.y,
            //	0f
            //) ;
        }
        public void GazeEntered(GameObject value)
        {
            if (_tooltip == null)
            {
                return;
            }
            _tooltip.transform.position = calculateTooltipPosition(
                Camera.main,
                GazeManager.Instance.HitInfo
                );
            //_tooltip.transform.position =Camera.main.transform.position + .8f * Camera.main.transform.forward ;
            _tooltip.SetActive(true);
            _tooltip.GetComponent <Tooltip> ()._userMessage.text = value.name;

            int    index = 0, dbid = 0;
            string pathid = "";

            ForgeImport.decodeName(value.name, ref index, ref dbid, ref pathid);
            GameObject root = value.GetComponent <Collider> ().transform.root.gameObject;    // should be _root for now
            TextAsset  text = Resources.Load <TextAsset> (root.name + "-properties");

            if (text == null || text.text == "")
            {
                return;
            }
            JSONNode  json = JSON.Parse(text.text);
            JSONArray arr  = json ["data"] ["collection"].AsArray;

            foreach (JSONNode obj in arr)
            {
                if (obj ["objectid"].AsInt == dbid)
                {
                    _tooltip.SetActive(true);
                    _tooltip.GetComponent <Tooltip> ()._userMessage.text = obj ["name"];
                    break;
                }
            }
        }
 public IEnumerator Scale(Transform thisTransform, float byThatMuch, float value, ScaleObject.ScaleType moveType)
 {
     _bounds = ForgeImport.GameObjectBounds(thisTransform.gameObject);
     yield return(Scale(thisTransform, thisTransform.localScale, thisTransform.localScale * byThatMuch, value, moveType));
 }
示例#8
0
 public static void AutoScale()
 {
     ForgeImport.AutoScale(Selection.activeGameObject, true);
 }