2 using FarseerPhysics.Dynamics.Joints;
3 using Microsoft.Xna.Framework;
4 using Microsoft.Xna.Framework.Graphics;
8 partial class EnemyAIController : AIController
10 public override void DebugDraw(SpriteBatch spriteBatch)
20 if (target !=
null && target.Entity !=
null)
22 var memory = GetTargetMemory(target);
25 Vector2 targetPos = memory.Location;
26 targetPos.Y = -targetPos.Y;
27 GUI.DrawLine(spriteBatch, pos, targetPos, Color.White * 0.5f, 0, 4);
28 GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $
"{target.Entity} ({memory.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
37 targetPos = attackWorldPos;
39 targetPos.Y = -targetPos.Y;
41 GUI.DrawLine(spriteBatch, pos, targetPos, GUIStyle.Red * 0.5f, 0, 4);
42 if (wallTarget !=
null && !IsCoolDownRunning)
44 Vector2 wallTargetPos = wallTarget.Position;
45 if (wallTarget.Structure.Submarine !=
null) { wallTargetPos += wallTarget.Structure.Submarine.Position; }
46 wallTargetPos.Y = -wallTargetPos.Y;
47 GUI.DrawRectangle(spriteBatch, wallTargetPos -
new Vector2(10.0f, 10.0f),
new Vector2(20.0f, 20.0f), Color.Orange,
false);
48 GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
50 GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $
"{SelectedAiTarget.Entity}", GUIStyle.Red, Color.Black);
51 GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 40.0f, $
"{targetValue.FormatZeroDecimal()} (M: {SelectedTargetMemory?.Priority.FormatZeroDecimal()}, P: {SelectedTargetingParams?.Priority.FormatZeroDecimal()})", GUIStyle.Red, Color.Black);
58 Color stateColor = Color.White;
62 stateColor = IsCoolDownRunning ? Color.Orange : GUIStyle.Red;
65 stateColor = Color.LightBlue;
68 stateColor = Color.White;
71 stateColor = Color.Brown;
74 GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 80.0f,
State.ToString(), stateColor, Color.Black);
76 if (
State ==
AIState.Attack && selectedTargetingParams !=
null && selectedTargetingParams.AttackPattern ==
AttackPattern.Circle)
78 GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 100.0f,
CirclePhase.ToString(), stateColor, Color.Black);
85 GUI.DrawLine(spriteBatch,
86 ConvertUnits.ToDisplayUnits(
new Vector2(attachJoint.WorldAnchorA.X, -attachJoint.WorldAnchorA.Y)),
87 ConvertUnits.ToDisplayUnits(
new Vector2(attachJoint.WorldAnchorB.X, -attachJoint.WorldAnchorB.Y)), GUIStyle.Green, 0, 4);
92 GUI.DrawLine(spriteBatch, pos,
99 var path = pathSteering.CurrentPath;
102 if (path.CurrentNode !=
null)
104 GUI.DrawLine(spriteBatch, pos,
105 new Vector2(path.CurrentNode.DrawPosition.X, -path.CurrentNode.DrawPosition.Y),
106 Color.DarkViolet, 0, 3);
108 GUI.DrawString(spriteBatch, pos -
new Vector2(0, 100),
"Path cost: " + path.Cost.FormatZeroDecimal(), Color.White, Color.Black * 0.5f);
110 for (
int i = 1; i < path.Nodes.Count; i++)
112 var previousNode = path.Nodes[i - 1];
113 var currentNode = path.Nodes[i];
114 GUI.DrawLine(spriteBatch,
115 new Vector2(currentNode.DrawPosition.X, -currentNode.DrawPosition.Y),
116 new Vector2(previousNode.DrawPosition.X, -previousNode.DrawPosition.Y),
117 GUIStyle.Red * 0.5f, 0, 3);
119 GUIStyle.SmallFont.DrawString(spriteBatch,
120 currentNode.ID.ToString(),
121 new Vector2(currentNode.DrawPosition.X - 10, -currentNode.DrawPosition.Y - 30),
131 hitPos.Y = -hitPos.Y;
138 GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(
new Vector2(
Steering.X, -
Steering.Y)), Color.Blue, width: 3);
AITarget _selectedAiTarget
AITarget SelectedAiTarget
SteeringManager steeringManager
override Vector2 DrawPosition
readonly AnimController AnimController
override void DebugDraw(SpriteBatch spriteBatch)
virtual Vector2 DrawPosition
List< Joint > AttachJoints
Vector2 AvoidRayCastHitPosition