Entity.fs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. namespace RL
  2. open Raylib_CsLo
  3. open Garnet.Composition
  4. open RL.Action
  5. open RL.AI
  6. open RL.Components
  7. open RL.FieldOfVision
  8. module EntityFactory =
  9. let Player(world : Container) =
  10. (world.Create()
  11. .With("Player")
  12. .With(Player())
  13. .With(BlocksMovement())
  14. .With({ x = 0; y = 0})
  15. .With({ spriteID = 64; color = Raylib.WHITE })
  16. .With(FieldOfVision(8))
  17. .With(ActionDefs.AwaitAction)
  18. .With({ap = 100; priority = 99})
  19. ).Id
  20. let Orc(world : Container) =
  21. (world.Create()
  22. .With("Orc")
  23. .With(Enemy())
  24. .With(BlocksMovement())
  25. .With({ x = 0; y = 0})
  26. .With({ spriteID = 111; color = Raylib.RED })
  27. .With(FieldOfVision(5))
  28. .With(ActionDefs.AwaitAction)
  29. .With({ap = 100; priority = 0})
  30. .With(BaseAI())
  31. ).Id
  32. let Troll(world : Container) =
  33. (world.Create()
  34. .With("Troll")
  35. .With(Enemy())
  36. .With(BlocksMovement())
  37. .With({ x = 0; y = 0})
  38. .With({ spriteID = 84; color = Raylib.RED })
  39. .With(FieldOfVision(5))
  40. .With(ActionDefs.AwaitAction)
  41. .With({ap = 50; priority = 0})
  42. .With(BaseAI())
  43. ).Id