1 using Microsoft.Xna.Framework;
8 partial class HumanAIController : AIController
10 public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
16 Vector2 textOffset =
new Vector2(-40, -160);
25 Vector2 stringDrawPos = pos + textOffset;
26 GUI.DrawString(spriteBatch, stringDrawPos,
Character.
Name, Color.White, Color.Black);
32 currentOrders.Sort((x, y) => y.ManualPriority.CompareTo(x.ManualPriority));
33 for (
int i = 0; i < currentOrders.Count; i++)
35 stringDrawPos +=
new Vector2(0, 20);
36 var order = currentOrders[i];
37 GUI.DrawString(spriteBatch, stringDrawPos, $
"ORDER {i + 1}: {order.Objective.DebugTag} ({order.Objective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
42 stringDrawPos +=
new Vector2(0, 20);
43 GUI.DrawString(spriteBatch, stringDrawPos - textOffset, $
"Waiting... {ObjectiveManager.WaitTimer.FormatZeroDecimal()}", Color.White, Color.Black);
46 if (currentObjective !=
null)
49 if (currentOrder ==
null || currentOrder.Priority <= 0)
51 stringDrawPos +=
new Vector2(0, 20);
52 GUI.DrawString(spriteBatch, stringDrawPos, $
"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
54 var subObjective = currentObjective.CurrentSubObjective;
55 if (subObjective !=
null)
57 stringDrawPos +=
new Vector2(0, 20);
58 GUI.DrawString(spriteBatch, stringDrawPos, $
"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
61 if (activeObjective !=
null)
63 stringDrawPos +=
new Vector2(0, 20);
64 GUI.DrawString(spriteBatch, stringDrawPos, $
"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
68 Vector2 objectiveStringDrawPos = stringDrawPos +
new Vector2(120, 40);
72 GUI.DrawString(spriteBatch, objectiveStringDrawPos, $
"{objective.DebugTag} ({objective.Priority.FormatZeroDecimal()})", Color.White, Color.Black * 0.5f);
73 objectiveStringDrawPos +=
new Vector2(0, 18);
78 var path = pathSteering.CurrentPath;
81 for (
int i = 1; i < path.Nodes.Count; i++)
83 var previousNode = path.Nodes[i - 1];
84 var currentNode = path.Nodes[i];
85 bool isPathActive = !path.Finished && !path.IsAtEndNode;
86 Color pathColor = isPathActive ? Color.Blue * 0.5f : Color.Gray;
87 GUI.DrawLine(spriteBatch,
88 new Vector2(currentNode.DrawPosition.X, -currentNode.DrawPosition.Y),
89 new Vector2(previousNode.DrawPosition.X, -previousNode.DrawPosition.Y),
94 GUIStyle.SmallFont.DrawString(spriteBatch,
95 currentNode.ID.ToString(),
96 new Vector2(currentNode.DrawPosition.X - 10, -currentNode.DrawPosition.Y - 30),
100 if (path.CurrentNode !=
null)
102 GUI.DrawLine(spriteBatch, pos,
103 new Vector2(path.CurrentNode.DrawPosition.X, -path.CurrentNode.DrawPosition.Y),
104 Color.BlueViolet, 0, 3);
106 GUI.DrawString(spriteBatch, stringDrawPos +
new Vector2(0, 40),
"Path cost: " + path.Cost.FormatZeroDecimal(), Color.White, Color.Black * 0.5f);
111 GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(
new Vector2(
Steering.X, -
Steering.Y)), Color.Blue, width: 3);
115 Vector2 gapPosition = gotoObjective.TargetGap.WorldPosition;
116 gapPosition.Y = -gapPosition.Y;
117 GUI.DrawRectangle(spriteBatch, gapPosition -
new Vector2(10.0f, 10.0f),
new Vector2(20.0f, 20.0f), Color.Orange,
false);
118 GUI.DrawLine(spriteBatch, pos, gapPosition, Color.Orange * 0.5f, 0, 5);
AITarget SelectedAiTarget
SteeringManager steeringManager
AIObjective GetActiveObjective()
List< AIObjective > Objectives
Excluding the current order.
AIObjective CurrentObjective
Includes orders.
AIObjective?? CurrentOrder
The AIObjective in CurrentOrders with the highest AIObjective.Priority
List< Order > CurrentOrders
float? WaitTimer
When set above zero, the character will stand still doing nothing until the timer runs out....
static Character? Controlled
readonly AnimController AnimController
virtual Vector2 WorldPosition
AIObjectiveManager ObjectiveManager
override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)