示例#1
0
        public bool AddBehaviour(IGizmoBehaviour behaviour)
        {
            if (behaviour == null || behaviour.Gizmo != null)
            {
                return(false);
            }

            GizmoBehaviorInitParams initParams = new GizmoBehaviorInitParams();

            initParams.Gizmo = this;

            behaviour.Init_SystemCall(initParams);
            if (!_behaviours.Add(behaviour))
            {
                return(false);
            }

            Type behaviourType = behaviour.GetType();

            if (behaviourType == typeof(MoveGizmo))
            {
                _moveGizmo = behaviour as MoveGizmo;
            }
            else if (behaviourType == typeof(RotationGizmo))
            {
                _rotationGizmo = behaviour as RotationGizmo;
            }
            else if (behaviourType == typeof(ScaleGizmo))
            {
                _scaleGizmo = behaviour as ScaleGizmo;
            }
            else if (behaviourType == typeof(UniversalGizmo))
            {
                _universalGizmo = behaviour as UniversalGizmo;
            }
            else if (behaviourType == typeof(SceneGizmo))
            {
                _sceneGizmo = behaviour as SceneGizmo;
            }
            else if (behaviourType == typeof(BoxGizmo))
            {
                _boxGizmo = behaviour as BoxGizmo;
            }
            else if (behaviourType == typeof(ObjectTransformGizmo))
            {
                _objectTransformGizmo = behaviour as ObjectTransformGizmo;
            }
            else if (behaviourType == typeof(ObjectExtrudeGizmo))
            {
                _objectExtrudeGizmo = behaviour as ObjectExtrudeGizmo;
            }

            behaviour.OnAttached();
            behaviour.OnEnabled();

            return(true);
        }
示例#2
0
 public void Init_SystemCall(GizmoBehaviorInitParams initParams)
 {
     _gizmo = initParams.Gizmo;
 }