當前位置: 首頁>>代碼示例>>C#>>正文


C# Line.GetComponent方法代碼示例

本文整理匯總了C#中System.Line.GetComponent方法的典型用法代碼示例。如果您正苦於以下問題:C# Line.GetComponent方法的具體用法?C# Line.GetComponent怎麽用?C# Line.GetComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Line的用法示例。


在下文中一共展示了Line.GetComponent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CurveHandle

        /// <summary>
        /// </summary>
        /// <param name="buttonTemplate"> </param>
        /// <param name="lineTemplate"> </param>
        /// <param name="pos"> </param>
        /// <param name="prevComponent"> </param>
        /// <param name="nextComponent"> </param>
        public CurveHandle(ButtonGenerator buttonTemplate, LineGenerator lineTemplate, Vector2 pos, Vector2 prevComponent, Vector2 nextComponent)
        {
            buttonTemplate = new ButtonGenerator("HullEditorHandle.json");
            buttonTemplate.Identifier = (int) HandleType.Center;
            buttonTemplate.X = pos.X;
            buttonTemplate.Y = pos.Y;

            _centerButton = buttonTemplate.GenerateButton();
            _centerButton.GetComponent<DraggableComponent>().DragMovementDispatcher += TranslateToLinks;
            _centerButton.GetComponent<DraggableComponent>().DragMovementClamp += ClampHandleMovement;

            buttonTemplate.Identifier = (int) HandleType.Prev;
            buttonTemplate.X = prevComponent.X + pos.X;
            buttonTemplate.Y = prevComponent.Y + pos.Y;
            _prevButton = buttonTemplate.GenerateButton();
            _prevButton.GetComponent<DraggableComponent>().DragMovementDispatcher += TranslateToLinks;
            _prevButton.GetComponent<DraggableComponent>().DragMovementClamp += ClampHandleMovement;

            buttonTemplate.Identifier = (int) HandleType.Next;
            buttonTemplate.X = nextComponent.X + pos.X;
            buttonTemplate.Y = nextComponent.Y + pos.Y;
            _nextButton = buttonTemplate.GenerateButton();
            _nextButton.GetComponent<DraggableComponent>().DragMovementDispatcher += TranslateToLinks;
            _nextButton.GetComponent<DraggableComponent>().DragMovementClamp += ClampHandleMovement;

            _prevLine = lineTemplate.GenerateLine();
            _nextLine = lineTemplate.GenerateLine();

            _prevLine.OriginPoint = _centerButton.CentPosition;
            _prevLine.DestPoint = _prevButton.CentPosition;

            _nextLine.OriginPoint = _centerButton.CentPosition;
            _nextLine.DestPoint = _nextButton.CentPosition;

            _nextButton.GetComponent<FadeComponent>().ForceFadeout();
            _prevButton.GetComponent<FadeComponent>().ForceFadeout();
            _centerButton.GetComponent<FadeComponent>().ForceFadeout();

            _prevLine.GetComponent<FadeComponent>().ForceFadeout();
            _nextLine.GetComponent<FadeComponent>().ForceFadeout();

            _nextButton.GetComponent<FadeComponent>().ForceFadeout();
            _prevButton.GetComponent<FadeComponent>().ForceFadeout();
            _centerButton.GetComponent<FadeComponent>().ForceFadeout();

            _prevLine.GetComponent<FadeComponent>().ForceFadeout();
            _nextLine.GetComponent<FadeComponent>().ForceFadeout();

            InterlinkButtonEvents();
        }
開發者ID:bsamuels453,項目名稱:Drydock,代碼行數:57,代碼來源:CurveHandle.cs


注:本文中的System.Line.GetComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。