Beispiel #1
0
 /// <summary>
 /// 添加“摄像机围绕物体旋转”
 /// </summary>
 public MCCameraRotateAround AddCameraCenterObjectRotation()
 {
     cameraRotateAround = OperaObject.GetComponent <MCCameraRotateAround>() ?? OperaObject.AddComponent <MCCameraRotateAround>();
     // ObjectRatation.SetOperaType(ObjectOperaType.摄像机围绕物体旋转);
     cameraRotateAround.hideFlags = HideFlags.HideInInspector;
     return(cameraRotateAround);
 }
        /// <summary>
        /// 操作状态
        /// </summary>
        public void OnOperaStatus()
        {
            if (features.operaType != features.beforeChange)
            {
                switch (features.beforeChange)
                {
                case ObjectOperaType.无:
                    features.RemoveNone();
                    _noneController = null;
                    break;

                case ObjectOperaType.能抓取:
                    features.RemoveCanGrab();
                    _cangrabController = null;
                    break;

                case ObjectOperaType.物体自身旋转:
                    features.RemoveRotation();
                    _objectRatationController = null;
                    break;

                case ObjectOperaType.摄像机围绕物体旋转:
                    features.RemoveCameraCenterObjectRotation();
                    _rotateAround = null;
                    break;

                case ObjectOperaType.自定义:
                    features.RemoveCustomize();
                    _customizeController = null;
                    break;

                case ObjectOperaType.物体式按钮:
                    features.RemoveObjectButton();
                    _objectButton = null;
                    break;

                default:
                    break;
                }
                features.beforeChange = features.operaType;
            }

            switch (features.operaType)
            {
            case ObjectOperaType.无:
                if (_noneController == null)
                {
                    _noneController = features.AddNone();
                }
                break;

            case ObjectOperaType.能抓取:
                if (_cangrabController == null)
                {
                    _cangrabController = features.AddCanGrab();
                }
                break;

            case ObjectOperaType.物体自身旋转:
                if (_objectRatationController == null)
                {
                    _objectRatationController = features.AddSelfRotation();
                }
                break;

            case ObjectOperaType.摄像机围绕物体旋转:
                if (_rotateAround == null)
                {
                    _rotateAround = features.AddCameraCenterObjectRotation();
                }
                break;

            case ObjectOperaType.自定义:
                if (_customizeController == null)
                {
                    _customizeController = features.AddCustomize();
                }
                break;

            case ObjectOperaType.物体式按钮:
                if (_objectButton == null)
                {
                    _objectButton = features.AddObjectButton();
                }
                break;

            default:
                break;
            }
        }