Example #1
0
        private void DebugActivity()
        {
            if (DebuggingVariables.ShowUnitPaths)
            {
                int numberOfLinesNeeded = this.ImmediateGoal?.Path?.Count ?? 0;

                while (this.pathLines.Count < numberOfLinesNeeded)
                {
                    var line = new Line();
                    line.Visible = true;
                    pathLines.Add(line);
                }
                while (this.pathLines.Count > numberOfLinesNeeded)
                {
                    ShapeManager.Remove(pathLines.Last());
                }

                for (int i = 0; i < numberOfLinesNeeded; i++)
                {
                    Vector3 pointBefore;
                    if (i == 0)
                    {
                        pointBefore = this.Position;
                    }
                    else
                    {
                        pointBefore = ImmediateGoal.Path[i - 1].Position;
                    }
                    Vector3 pointAfter = ImmediateGoal.Path[i].Position;

                    pathLines[i].SetFromAbsoluteEndpoints(pointBefore, pointAfter);
                }
            }
        }