root/src/AIRendering/DrawableWorld.cs

1623
56
                    position,
56
                    position,
57
                    position + new Vector2(0, item.Height),
57
                    position + new Vector2(0, item.Height),
58
                           Color.Yellow);
58
                           Color.Yellow);
59
60
61
62
                Color pathColor;
63
                Color bisectorsColor;
64
                foreach (var path in item.PredeterminedPaths)
65
                {
66
67
68
                    for (int index = 0; index < path.Nodes.Count; index++)
69
                    {
70
71
                        pathColor = Color.Gold;
72
                        bisectorsColor = Color.Honeydew;
73
74
75
                        if (index < path.Nodes.Count - 1)
76
                        {
77
                            Vector2 pos1;
78
                            pos1 = item.GetCell(path.Nodes[index].X, path.Nodes[index].Y).Position;
79
                            Vector2 pos2 = item.GetCell(path.Nodes[index + 1].X, path.Nodes[index + 1].Y).Position;
80
                            
81
                            batch.DrawLine(
82
                                pos1,
83
                                pos2,
84
                                pathColor
85
                            );
86
                        }
87
                        if (index < path.Nodes.Count - 1)
88
                        {
89
                            batch.DrawLine(
90
                                path.Nodes[index].nodePosition,
91
                                path.Nodes[index + 1].nodePosition,
92
                                pathColor
93
                            );
94
                        }
95
96
                        batch.DrawLine(
97
                            path.Nodes[index].biNormalStart,
98
                            path.Nodes[index].biNormalEnd,
99
                            bisectorsColor
100
                            );
101
                        
102
                    }
103
                }
59
            }
104
            }
60
            foreach (DrawableActor item1 in Actors)
105
            foreach (DrawableActor item1 in Actors)
61
            {
106
            {
...
...
63
            }
108
            }
64
        }
109
        }
65
110
66
        private void DrawCell(PrimitiveBatch batch, QuadTreePositionItem<GridCell> item)
111
        protected virtual void DrawCell(PrimitiveBatch batch, QuadTreePositionItem<GridCell> item)
67
        {
112
        {
68
            batch.DrawBox(item.Rect.TopLeft, item.Rect.BottomRight, Color.White);
113
            batch.DrawBox(item.Rect.TopLeft, item.Rect.BottomRight, Color.White);
69
            Vector2 firstLine = item.Rect.TopLeft + new Vector2(3, 3);
114
            Vector2 firstLine = item.Rect.TopLeft + new Vector2(3, 3);
...
...
83
                    item.Rect.BottomLeft + new Vector2(24, -24),
128
                    item.Rect.BottomLeft + new Vector2(24, -24),
84
                    Color.Green);
129
                    Color.Green);
85
            }
130
            }
131
            foreach (var item1 in Map.ClusterGrid.Entrances)
132
            {
133
                batch.DrawLine(
134
                    item1.CellA.Position,
135
                    item1.CellB.Position,
136
                    Color.White);
137
138
                batch.DrawCircle(
139
                    item1.CellA.Position,5,Color.Blue);
140
                batch.DrawCircle(
141
                    item1.CellB.Position, 5, Color.Blue);
142
                        
143
            }
86
            /*for (int i = 0; i < item.Parent.Type; i++)
144
            /*for (int i = 0; i < item.Parent.Type; i++)
87
            {
145
            {
88
                batch.DrawLine(
146
                batch.DrawLine(
...
...
91
                firstLine.X += 6;
149
                firstLine.X += 6;
92
            }*/
150
            }*/
93
151
94
            //string clearance = item.Parent.Labels[AIConsts.CLEARANCEVALUE].ToString();
152
            if (Batch != null)
95
            //Batch.DrawString(
96
            //    Font,
97
            //    clearance,
98
            //    (item.Position - batch.CameraPosition) / batch.Zoom, 
99
            //    Color.White,
100
            //    0,
101
            //    new Vector2(8,8),
102
            //    1,
103
            //    SpriteEffects.None,
104
            //    0);
105
106
            if (item.Parent.Labels[AIConsts.ISVALIDCLUSTEREDGE] == 1)
107
            {
153
            {
108
                batch.DrawCircle(item.Parent.Position, 5, Color.Green);
154
                //string clearance = item.Parent.Labels[AIConsts.CLEARANCEVALUE].ToString();
109
                Vector2 half = new Vector2(item.Parent.Parent.CellSize / 2);
155
                //Batch.DrawString(
110
                batch.DrawLine(
156
                //    Font,
111
                    item.Rect.TopLeft+new Vector2(24),
157
                //    clearance,
112
                    item.Rect.BottomRight - new Vector2(24),
158
                //    (item.Position - batch.CameraPosition) / batch.Zoom,
113
                    Color.Green);
159
                //    Color.White,
160
                //    0,
161
                //    new Vector2(8, 8),
162
                //    1,
163
                //    SpriteEffects.None,
164
                //    0);
114
165
115
116
                batch.DrawLine(
117
                    item.Rect.TopRight - new Vector2(24, -24),
118
                    item.Rect.BottomLeft + new Vector2(24, -24),
119
                    Color.Green);
120
            }
166
            }
121
            if (item.Parent.Type == 0)
167
            if (item.Parent.Type == 0)
122
            {
168
            {