Exemple #1
0
        private void DrawBeizureLink(IPlatformDrawer platform, float scale)
        {
            var _startPos = ViewModel.ConnectorA.Bounds.center;
            var _endPos   = ViewModel.ConnectorB.Bounds.center;

            var _startRight = ViewModel.ConnectorA.Direction == ConnectorDirection.Output;
            var _endRight   = ViewModel.ConnectorB.Direction == ConnectorDirection.Output;


            var multiplier = Mathf.Min(30f, (_endPos.x - _startPos.x) * 0.3f);


            var m2 = 3;

            if (multiplier < 0)
            {
                _startRight = !_startRight;
                _endRight   = !_endRight;
            }


            var startTan = _startPos + (_endRight ? -Vector2.right * m2 : Vector2.right * m2) * multiplier;

            var endTan = _endPos + (_startRight ? -Vector2.right * m2 : Vector2.right * m2) * multiplier;

            var shadowCol = new Color(0, 0, 0, 0.1f);

            //if (ViewModel.IsFullColor)
            for (int i = 0; i < 3; i++)     // Draw a shadow
            {
                platform.DrawBezier(_startPos * scale, _endPos * scale, startTan * scale,
                                    endTan * scale, shadowCol, (i + 1) * 5);
            }

            platform.DrawBezier(_startPos * scale, _endPos * scale, startTan * scale,
                                endTan * scale, ViewModel.CurrentColor, 3);
        }
        public override void Draw(IPlatformDrawer platform, float scale)
        {
            base.Draw(platform, scale);
            var _startRight = StartConnector.Direction == ConnectorDirection.Output;
            var _endRight = false;

            var startTan = _startPos + (_endRight ? -Vector2.right * 3 : Vector2.right * 3) * 30;

            var endTan = _endPos + (_startRight ? -Vector2.right * 3 : Vector2.right * 3) * 30;

            var shadowCol = new Color(0, 0, 0, 0.1f);

            for (int i = 0; i < 3; i++) // Draw a shadow
                platform.DrawBezier(_startPos * scale,
                    _endPos * scale, startTan * scale,
                    endTan * scale, shadowCol, (i + 1) * 5);

            InvertGraphEditor.PlatformDrawer.DrawBezier(_startPos * scale, _endPos * scale,
                startTan * scale, endTan * scale, color, 3);
        }
        public override void Draw(IPlatformDrawer platform, float scale)
        {
            base.Draw(platform, scale);
            var _startRight = StartConnector.Direction == ConnectorDirection.Output;
            var _endRight   = false;

            var startTan = _startPos + (_endRight ? -Vector2.right * 3 : Vector2.right * 3) * 30;

            var endTan = _endPos + (_startRight ? -Vector2.right * 3 : Vector2.right * 3) * 30;

            var shadowCol = new Color(0, 0, 0, 0.1f);

            for (int i = 0; i < 3; i++) // Draw a shadow
            {
                platform.DrawBezier(_startPos * scale,
                                    _endPos * scale, startTan * scale,
                                    endTan * scale, shadowCol, (i + 1) * 5);
            }

            InvertGraphEditor.PlatformDrawer.DrawBezier(_startPos * scale, _endPos * scale,
                                                        startTan * scale, endTan * scale, color, 3);
        }