You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: browser/src/CrossPlatform/AI.fs
+16-1Lines changed: 16 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -58,12 +58,27 @@ let getNextState canSeePlayer enemy =
58
58
)()
59
59
|_-> enemy.State
60
60
61
+
// This conversion required because FSharp do not play
62
+
// along with NativeAOT inside interpolated strings + enums.
63
+
// Be explicit about how to display strings.
64
+
letgetStateString state =
65
+
match state with
66
+
| EnemyStateType.Standing ->"Standing"
67
+
| EnemyStateType.Ambushing ->"Ambushing"
68
+
| EnemyStateType.Attack ->"Attack"
69
+
| EnemyStateType.Path ->"Path"
70
+
| EnemyStateType.Pain ->"Pain"
71
+
| EnemyStateType.Shoot ->"Shoot"
72
+
| EnemyStateType.Chase ->"Chase"
73
+
| EnemyStateType.Die ->"Die"
74
+
| EnemyStateType.Dead ->"Dead"
75
+
61
76
letpreProcess game enemy =
62
77
// preprocess looks for state changes based on the current game world state
63
78
letcanSeePlayer= enemy |> isPlayerVisibleToEnemy game
64
79
letnewState= enemy |> getNextState canSeePlayer
65
80
if newState <> enemy.State then
66
-
Utils.log $"Enemy at {enemy.BasicGameObject.Position.vX}, {enemy.BasicGameObject.Position.vY} moving from {enemy.State} to {newState}"
81
+
Utils.log $"Enemy at {enemy.BasicGameObject.Position.vX}, {enemy.BasicGameObject.Position.vY} moving from {getStateString enemy.State} to {getStateString newState}"
0 commit comments