Simulation von Bürgern
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

citizen.pde 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. Citizen mensch;
  2. //debug settings
  3. boolean b_smallerImage = true; //use a cropped, smaller version of the 1920x1080 image for faster development
  4. boolean b_loadSun = false; //load sun from web-api instead of local json file (local file is adressed to january 4th 2019. might implement a check that downloads today's information only once...
  5. //void mouseClicked(){
  6. //mensch.goTo(112);
  7. //}
  8. class Citizen{
  9. int i_xSpawn, i_ySpawn, i_xPos, i_yPos, i_diameter;
  10. boolean b_linked;
  11. int i_home;
  12. String S_name;
  13. //0-100:
  14. //motivation (bei arbeiter montag ~40, freitag ~80 - 100)
  15. //7 emotionen?
  16. // berufsfeld: webdesigner, pädagoge, schmuckdesigner, schmied
  17. // berufsstatus: beamter, selbstständiger, unternehmer, angestellter, grundschüler, gymnasiast, hauptschüler, realschüler, azubi, student, rentner
  18. // identität: gelbhemd, lokal, regional, national, international, fremd,
  19. //names of pathfinding algorithms: greedy best first search, uniform cost search, a star search
  20. Citizen(int home, String name){
  21. i_home = home;
  22. S_name = name;
  23. i_diameter = 15;
  24. }
  25. void goTo(int house){
  26. println("want to go to house " + house);
  27. }
  28. void spawn(int house){
  29. PVector v2_spawnPoint = spawnAreas.get(house).v2_randomSpawnPoint();
  30. i_xSpawn = int(v2_spawnPoint.x);
  31. i_ySpawn = int(v2_spawnPoint.y);
  32. i_xPos = i_xSpawn;
  33. i_yPos = i_ySpawn;
  34. b_linked = true;
  35. }
  36. void despawn(){
  37. b_linked = false;
  38. }
  39. void display(){
  40. ellipse(i_xPos, i_yPos, i_diameter, i_diameter);
  41. textSize(10);
  42. text(S_name, i_xPos, i_yPos-10);
  43. }
  44. }
  45. void setup() {
  46. size(400, 300);
  47. fill(0);
  48. //ft = new SimpleDateFormat ("HH:mm:ss");
  49. if(b_smallerImage) img_houses = loadImage(dataPath("map/houses_with_borders_small.png"));
  50. else img_houses = loadImage(dataPath("map/houses_with_borders.png"));
  51. img_streets = loadImage(dataPath("map/streets.png"));
  52. initHouses();
  53. blendMode(MULTIPLY);
  54. surface.setSize(img_houses.width, img_houses.height);
  55. initPathFinding();
  56. initWeather();
  57. mensch = new Citizen(59, "Pe");
  58. mensch.spawn(59);
  59. }
  60. void draw() {
  61. background(255);
  62. image(img_houses, 0, 0, img_houses.width, img_houses.height);
  63. //image(img_streets, 0, 0, img_houses.width, img_houses.height);
  64. textSize(7);
  65. textAlign(CENTER);
  66. for (SpawnArea spawn : spawnAreas) {
  67. spawn.display();
  68. }
  69. nodeDisplay();
  70. mensch.display();
  71. UI();
  72. }