Пример #1
0
        private void RenderLineWithDots(Vector2 startPos, Vector2 endPos, Vector2 offset, Color color, float dotAge, int width)
        {
            Vector2 startWithOffset = startPos + offset;
            Vector2 endWithOffset   = endPos + offset;

            RenderingHelper.RenderLineInMonitorWindow(startWithOffset, endWithOffset, color, width);
            RenderDots(startWithOffset, endWithOffset, color, dotAge);
        }
Пример #2
0
        private void RenderLineAcrossWayPoints(float offset, int width, bool inMiniMap)
        {
            Vector2 previousWayPointPosition = CallerActor.Position;

            if (wayPoints.Count > 0)
            {
                previousWayPointPosition += (wayPoints[0].GridPosition - CallerActor.GridPosition).GetPerpendicular().normalized *offset;
            }
            else
            {
                previousWayPointPosition += (HandlerActor.GridPosition - CallerActor.GridPosition).GetPerpendicular().normalized *offset;
            }

            for (int i = 0; i < wayPoints.Count; i++)
            {
                WayPoint wayPoint         = wayPoints[i];
                Vector2  wayPointPosition = wayPoint.GetPosition(CallerActor, offset);

                if (inMiniMap)
                {
                    RenderingHelper.RenderLineInMiniMap(previousWayPointPosition, wayPointPosition, lineColor, width);
                }
                else
                {
                    RenderingHelper.RenderLineInMonitorWindow(previousWayPointPosition, wayPointPosition, lineColor, width);
                }

                previousWayPointPosition = wayPointPosition;
            }

            Vector2 endPosition = HandlerActor.Position;

            if (wayPoints.Count > 0)
            {
                endPosition += (wayPoints[wayPoints.Count - 1].GridPosition - CallerActor.GridPosition).GetPerpendicular().normalized *offset;
            }
            else
            {
                endPosition += (HandlerActor.GridPosition - CallerActor.GridPosition).GetPerpendicular().normalized *offset;
            }

            if (inMiniMap)
            {
                RenderingHelper.RenderLineInMiniMap(previousWayPointPosition, endPosition, lineColor, width);
            }
            else
            {
                RenderingHelper.RenderLineInMonitorWindow(previousWayPointPosition, endPosition, lineColor, width);
            }
        }
Пример #3
0
        private void RenderArrow(bool reversed, float offset, int width)
        {
            Vector2 direction;
            Vector2 position;

            Vector2 startPos;
            Vector2 endPos;

            if (!reversed)
            {
                startPos = CallerActor.Position;
                if (wayPoints.Count == 0)
                {
                    endPos = HandlerActor.Position;
                }
                else
                {
                    endPos = wayPoints[0].GetPosition(CallerActor, 0.0f);
                }
            }
            else
            {
                startPos = HandlerActor.Position;
                if (wayPoints.Count == 0)
                {
                    endPos = CallerActor.Position;
                }
                else
                {
                    endPos = wayPoints[wayPoints.Count - 1].GetPosition(CallerActor, 0.0f);
                }
            }

            direction = (endPos - startPos).normalized;
            position  = Vector2.Lerp(startPos, endPos, wayPoints.Count == 0 ? .45f : .9f);

            Vector2 perpendicular = direction.GetPerpendicular();
            Vector2 leftLine      = position + ArrowSize * (-direction + perpendicular);
            Vector2 rightLine     = position + ArrowSize * (-direction - perpendicular);

            Vector2 positionOffset = perpendicular * offset;

            RenderingHelper.RenderLineInMonitorWindow(position + positionOffset, leftLine + positionOffset, lineColor, width);
            RenderingHelper.RenderLineInMonitorWindow(position + positionOffset, rightLine + positionOffset, lineColor, width);
        }
Пример #4
0
        public void Render()
        {
            Vector2 start = TypeWidget.Position - .25f * ModelTypeWidget.Width * Vector2.right + .5f * ModelTypeWidget.Height * Vector2.up;

            foreach (ModelTypeWidgetNode node in nodes)
            {
                Vector2 end = node.TypeWidget.Position - .5f * ModelTypeWidget.Width * Vector2.right;
                Vector2 mid = new Vector2(start.x, end.y);
                RenderingHelper.RenderLineInMonitorWindow(start, mid, Color.white, 1);
                RenderingHelper.RenderLineInMonitorWindow(mid, end, Color.white, 1);
                start = new Vector2(TypeWidget.Position.x - .25f * ModelTypeWidget.Width, node.TypeWidget.Position.y);
            }

            TypeWidget.Render();

            foreach (ModelTypeWidgetNode node in nodes)
            {
                Vector2 aggregationCountPosition = node.TypeWidget.Position - .70f * ModelTypeWidget.Width * Vector2.right + CodeControlMonitorWindow.WindowOffset;
                CodeControlEditorStyles.SetLabelStyle(CodeControlEditorStyles.LabelStyle.AggregationCountType);
                GUI.Label(new Rect(aggregationCountPosition.x - 100, aggregationCountPosition.y - 8, 100, 30), node.AggregationCountType);
                CodeControlEditorStyles.ResetLabelStyle();
                node.Render();
            }
        }