Esempio n. 1
0
 /// <summary>
 /// 添加“桌面吸附及限制下陷”
 /// </summary>
 /// <returns></returns>
 public MCDeskLimit AddDeskLimit()
 {
     if (deskLimit == null)
     {
         deskLimit = OperaObject.GetComponent <MCDeskLimit>() ?? OperaObject.AddComponent <MCDeskLimit>();
     }
     deskLimit.hideFlags = HideFlags.HideInInspector;
     return(deskLimit);
 }
        /// <summary>
        /// 桌面吸附及限制下陷面板显示
        /// </summary>
        private void InspectorDeskLimit()
        {
            if (features.ActiveDeskLimit_)
            {
                _deskLimit = features.AddDeskLimit();
                if (_deskLimit == null)
                {
                    return;
                }
                EditorGUILayout.BeginVertical();
                _deskLimit.limitObj = EditorGUILayout.ObjectField("    *被限制的物体", _deskLimit.limitObj, typeof(GameObject), true) as GameObject;
                if (_deskLimit.limitObj == null)
                {
                    EditorGUILayout.HelpBox("请赋值被抓取物体本身", MessageType.None, false);
                }
                _deskLimit.openAdsorption = EditorGUILayout.Toggle("    开启桌面吸附", _deskLimit.openAdsorption);
                _deskLimit.limitSink      = EditorGUILayout.Toggle("    限制下陷到桌面下", _deskLimit.limitSink);
                _deskLimit.deskHeight     = EditorGUILayout.FloatField("    桌面高度", _deskLimit.deskHeight);
                _deskLimit.deskDistance   = EditorGUILayout.FloatField("    距离桌面多高开始吸附", _deskLimit.deskDistance);
                _deskLimit.boxCollider    = EditorGUILayout.ObjectField("    用于空间查询的BoxCollider", _deskLimit.boxCollider, typeof(BoxCollider), true) as BoxCollider;
                if (_deskLimit.boxCollider == null)
                {
                    EditorGUILayout.HelpBox("用于空间查询的BoxCollider,可以使用operaObject物体\n需包住物体的中心点。", MessageType.None, false);
                }
                _deskLimit.autoExtremum = EditorGUILayout.Toggle("    自动计算网格极值,蒙皮网格可能不准确", _deskLimit.autoExtremum);
                if (!_deskLimit.autoExtremum)
                {
                    _deskLimit.minPoint = EditorGUILayout.ObjectField("    网格极小点", _deskLimit.minPoint, typeof(Transform), true) as Transform;
                    _deskLimit.maxPoint = EditorGUILayout.ObjectField("    网格极大点", _deskLimit.maxPoint, typeof(Transform), true) as Transform;
                }

                EditorGUILayout.EndVertical();
            }
            else
            {
                features.RemoveDeskLimit();
                _deskLimit = null;
            }
        }