コード例 #1
0
 /// <summary>
 /// 添加“物体自身旋转”
 /// </summary>
 public MCObjectRotation AddSelfRotation()
 {
     ObjectRatation = OperaObject.GetComponent <MCObjectRotation>() ?? OperaObject.AddComponent <MCObjectRotation>();
     //  ObjectRatation.SetOperaType(ObjectOperaType.物体自身旋转);
     ObjectRatation.hideFlags = HideFlags.HideInInspector;
     return(ObjectRatation);
 }
コード例 #2
0
        /// <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;
            }
        }