diff --git a/CitizenClass.pde b/CitizenClass.pde index 3982b48..2fd61e8 100644 --- a/CitizenClass.pde +++ b/CitizenClass.pde @@ -1,30 +1,31 @@ import java.lang.Double; Citizen[] citizen = new Citizen[10]; -void initCitizen(){ +void initCitizen() { //namen: ethuriel, nathaniel, loriel, samuel, aluriel, aleriel, thaliel, suriel, kaliel, - - citizen[0] = new Citizen(59, "Test"); - citizen[1] = new Citizen(121, "Matze"); - citizen[2] = new Citizen(18, "Freddy"); - citizen[3] = new Citizen(59, "Korbi"); - citizen[4] = new Citizen(121, "Lotte"); - citizen[5] = new Citizen(18, "Reifi"); - citizen[6] = new Citizen(59, "Grasso"); - citizen[7] = new Citizen(121, "Nico"); - citizen[8] = new Citizen(18, "Victor"); - citizen[9] = new Citizen(59, "Paul"); + int[][] claireArray = { { 00, 2 }, { 1, 3} }; + println(int(hour() + citizen[0] = new Citizen(59, "Claire", claireArray); + //citizen[1] = new Citizen(121, "Matze"); + //citizen[2] = new Citizen(18, "Freddy"); + //citizen[3] = new Citizen(59, "Korbi"); + //citizen[4] = new Citizen(121, "Lotte"); + //citizen[5] = new Citizen(18, "Reifi"); + //citizen[6] = new Citizen(59, "Grasso"); + //citizen[7] = new Citizen(121, "Nico"); + //citizen[8] = new Citizen(18, "Victor"); + //citizen[9] = new Citizen(59, "Paul"); for (int i = 0; i < citizen.length; i++) { citizen[i].spawn(int(random(0, houses.size()))); } - + selectCitizen(0); - //citizen[2].spawn(59); + //citizen[2].spawn(59); } int i_selectedCitizen; -void selectCitizen(int i){ +void selectCitizen(int i) { citizen[i_selectedCitizen].b_selected = false; citizen[i].b_selected = true; i_selectedCitizen = i; @@ -39,7 +40,7 @@ class Citizen { float f_xPos, f_yPos; float f_movementSpeed = 10; boolean b_selected; - + //0-100: //motivation (bei arbeiter montag ~40, freitag ~80 - 100) //7 emotionen? @@ -54,11 +55,10 @@ class Citizen { - Citizen(int home, String name) { + Citizen(int home, String name, int[][] schedule) { i_home = home; S_name = name; i_diameter = 15; - pathFinder = makePathFinder(gs, pathAlgorithm); } @@ -111,7 +111,12 @@ class Citizen { } else { b_moving = false; nextNode = 0; - if (b_randomRun)goTo(int(random(0, pg_map.width)), int(random(0, pg_map.height))); + if (!b_randomRun) { + //check if standing on an other citizens position + + } else { + goTo(int(random(0, pg_map.width)), int(random(0, pg_map.height))); + } } } } @@ -129,15 +134,18 @@ class Citizen { } if (b_drawPathDestination) { pg_map.stroke(160, 0, 0); - if(b_selected) pg_map.fill(255, 0, 0); + if (b_selected) pg_map.fill(255, 0, 0); else pg_map.fill(0); pg_map.ellipse(rNodes[rNodes.length-1].xf(), rNodes[rNodes.length-1].yf(), nodeSize, nodeSize); } pg_map.popStyle(); } - if(b_selected) pg_map.fill(c_selectedCitizen); - pg_map.ellipse(f_xPos, f_yPos, i_diameter, i_diameter); + pg_map.stroke(255); pg_map.fill(0); + if (b_selected) pg_map.fill(c_selectedCitizen); + pg_map.ellipse(f_xPos, f_yPos, i_diameter, i_diameter); + pg_map.fill(255); + pg_map.textAlign(CENTER); pg_map.textSize(10); pg_map.text(S_name, f_xPos, f_yPos-10); } diff --git a/Map.pde b/Map.pde index 35ffc07..775014d 100644 --- a/Map.pde +++ b/Map.pde @@ -1,6 +1,7 @@ import java.util.ArrayDeque; import pathfinder.*; +PImage img_map; PImage img_houses; PImage img_streets; PGraphics pg_map; diff --git a/UI.pde b/UI.pde index 8c3ade8..cbce824 100644 --- a/UI.pde +++ b/UI.pde @@ -1,6 +1,8 @@ + +int i_uiTransparency = 200; void initUI() { i_uiX = 0; - i_uiY = 420; + i_uiY = 520; i_uiW = width; i_uiH = height - i_uiY; } @@ -11,17 +13,44 @@ void drawUI() { strokeWeight(1); line(i_uiX, i_uiY, i_uiX+i_uiW, i_uiY); strokeWeight(0); - fill(255, 230); + fill(255, i_uiTransparency); rect(i_uiX, i_uiY, i_uiW, i_uiH); - - + rect(6, 4, 140, 31, 6); fill(0); textSize(30); textAlign(LEFT); text(String.format("%02d", hour()) + ":" + String.format("%02d", minute()) + ":" + String.format("%02d", second()), 10, 30); - textSize(15); - text("FPS: " + int(frameRate), 10, i_uiY + 15); + + String[] debug = { + "FPS: " + int(frameRate), + " ", + "Selected Citizen ID: " + i_selectedCitizen, + "Name: " + citizen[i_selectedCitizen].S_name, + "x: " + citizen[i_selectedCitizen].f_xPos + " y: " + citizen[i_selectedCitizen].f_yPos, + "Movement speed: " + citizen[i_selectedCitizen].f_movementSpeed, + "Velocity: ", + "Outside", + "Mood: " + }; + int ts = i_debugTextSize; + textSize(ts); + int line = 0; + int maxLinesPerColumn = i_uiH/ts; + if (maxLinesPerColumn > 0) { + int requiredColumns = (debug.length/maxLinesPerColumn)+1; + for (int i = 0; i < requiredColumns; i++) { + while (((line-(maxLinesPerColumn*i)) * ts + ts)+i_uiY