/// <summary>
        /// Every DragPointsInspector instantiates this to manage its curve handling.
        /// </summary>
        /// <param name="mainComponent">The renderable main component, to retrieve IsLocked.</param>
        /// <param name="dragPointsInspector"></param>
        /// <exception cref="ArgumentException"></exception>
        public DragPointsHandler(IMainRenderableComponent mainComponent, IDragPointsInspector dragPointsInspector)
        {
            MainComponent      = mainComponent;
            DragPointInspector = dragPointsInspector;

            Transform = mainComponent.gameObject.transform;

            _sceneViewHandler = new DragPointsSceneViewHandler(this)
            {
                CurveWidth              = 10.0f,
                CurveColor              = Color.blue,
                CurveSlingShotColor     = Color.red,
                ControlPointsSizeRatio  = 1.0f,
                CurveTravellerSizeRatio = 0.75f
            };
        }
Esempio n. 2
0
        /// <summary>
        /// Every DragPointsInspector instantiates this to manage its curve handling.
        /// </summary>
        /// <param name="target"></param>
        /// <exception cref="ArgumentException"></exception>
        public DragPointsHandler(Object target)
        {
            Editable = target as IItemMainRenderableAuthoring
                       ?? throw new ArgumentException("Target must extend `IEditableItemAuthoring`.");

            DragPointEditable = target as IDragPointsEditable
                                ?? throw new ArgumentException("Target must extend `IDragPointsEditable`.");

            if (!(target is Behaviour))
            {
                throw new ArgumentException("Target must extend `Behavior`.");
            }
            Transform = (target as Behaviour).transform;

            _sceneViewHandler = new DragPointsSceneViewHandler(this)
            {
                CurveWidth              = 10.0f,
                CurveColor              = UnityEngine.Color.blue,
                CurveSlingShotColor     = UnityEngine.Color.red,
                ControlPointsSizeRatio  = 1.0f,
                CurveTravellerSizeRatio = 0.75f
            };
        }