diff options
Diffstat (limited to 'src/LivingVillage.Desktop')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index e2b520f..2e28760 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -70,6 +70,8 @@ module NpcView = | Sleep -> "sleep" | Wander -> "wander" | Work -> "work" + | Chat -> "chat" + | Work -> "work" type LivingVillageGame() as this = inherit Game() @@ -82,7 +84,7 @@ type LivingVillageGame() as this = let mutable atlas = Unchecked.defaultof<Texture2D> let mutable pixel = Unchecked.defaultof<Texture2D> let mutable map = MapGen.generate Sim.mapWidthTiles Sim.mapHeightTiles - let mutable world = Sim.initialWorld 42UL + let mutable world = Sim.initialWorldN 42UL Sim.npcCount let mutable camera = Vector2.Zero let mutable fpsFrames = 0 let mutable fpsSeconds = 0.0 @@ -139,10 +141,10 @@ type LivingVillageGame() as this = fpsFrames <- 0 fpsSeconds <- 0.0 let npcAction = - match world.Npcs with - | npc :: _ -> NpcView.actionName npc.Mind.Action - | [] -> "none" - this.Window.Title <- $"Living Village M1{titleSuffix} | fps {fps:F1} | tick {world.Tick} | npc {npcAction}" + if world.Npcs.Length > 0 then + NpcView.actionName world.Npcs.[0].Mind.Action + else "none" + this.Window.Title <- $"Living Village M3a{titleSuffix} | fps {fps:F1} | tick {world.Tick} | npc {npcAction}" printfn $"fps={fps:F1} tick={world.Tick} pos=({world.Avatar.Pos.X:F0},{world.Avatar.Pos.Y:F0})" override this.Draw(gameTime: GameTime) = @@ -163,9 +165,12 @@ type LivingVillageGame() as this = spriteBatch.Draw(atlas, dst, src, Color.White) let avatarDst = Rectangle(int world.Avatar.Pos.X - camX, int world.Avatar.Pos.Y - camY, Sim.tilePixels, Sim.tilePixels) - spriteBatch.Draw(pixel, avatarDst, Color.IndianRed) + spriteBatch.Draw(pixel, avatarDst, Color.Red) + let npcShades = + [| Color.Navy; Color.MediumBlue; Color.Blue; Color.RoyalBlue; Color.DodgerBlue |] for npc in world.Npcs do let npcDst = Rectangle(int npc.Pos.X - camX, int npc.Pos.Y - camY, Sim.tilePixels, Sim.tilePixels) - spriteBatch.Draw(pixel, npcDst, Color.Blue) + let (NpcId idx) = npc.Id + spriteBatch.Draw(pixel, npcDst, npcShades.[idx % npcShades.Length]) spriteBatch.End() |
