mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 12:49:45 +02:00
Manipulierte Hardware resettet nun nach 15 Sek.
This commit is contained in:
@@ -15,6 +15,7 @@ import de.heatup.mapengine.MapEngine;
|
||||
import de.heatup.mapengine.MapGrid;
|
||||
import de.heatup.mapengine.SpawnAssistant;
|
||||
import de.heatup.objects.StaticObject;
|
||||
import de.heatup.timers.HardwareResetTimers;
|
||||
import de.heatup.ui.KeyBindings;
|
||||
import de.heatup.ui.StatusPanelAdder;
|
||||
import de.heatup.ui.actionPanel.ActionControl;
|
||||
@@ -257,6 +258,7 @@ public class GameLoopD extends JFrame implements Runnable {
|
||||
kb.checkKeyActivity();
|
||||
ActionWatcher.tick();
|
||||
ActionControl.actionControl();
|
||||
HardwareResetTimers.tick();
|
||||
player01.tick();
|
||||
opponent01.tick();
|
||||
opponent02.tick();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package de.heatup.timers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import de.heatup.cfg.Config;
|
||||
import de.heatup.logging.Logger;
|
||||
import de.heatup.ui.actionPanel.HardewareManipulate;
|
||||
|
||||
public class HardwareResetTimers {
|
||||
private static int tickCount = 0;
|
||||
private static int tickRoundMax = 10000;
|
||||
private static int nrOfTicksUntilReset = 900; // entspricht 15 sekunden ingame zeit (nicht unbedingt echtzeit!); berechnet durch 15*targetTickRate im Gameloop.
|
||||
private static Map<Character, Integer> HardwareResetTickstamps = new HashMap<Character, Integer>();
|
||||
public static void tick() {
|
||||
tickCount++;
|
||||
if (tickCount>=tickRoundMax) {
|
||||
tickCount = 0;
|
||||
}
|
||||
for (char i = Config.firstHardwareChar; i<=Config.lastHardwareChar; i++) {
|
||||
if (HardwareResetTickstamps.containsKey(i)) {
|
||||
if (HardwareResetTickstamps.get(i).equals(tickCount)) {
|
||||
Logger.write("Hardware "+i+" reset");
|
||||
HardewareManipulate.resetHardware(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void setManipulated(char c) {
|
||||
int resetTimestamp = tickCount+nrOfTicksUntilReset;
|
||||
if (resetTimestamp > tickRoundMax) {
|
||||
resetTimestamp = resetTimestamp % tickRoundMax;
|
||||
}
|
||||
HardwareResetTickstamps.put(c, resetTimestamp);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package de.heatup.ui.actionPanel;
|
||||
|
||||
import de.heatup.timers.HardwareResetTimers;
|
||||
|
||||
public class HardewareManipulate {
|
||||
private static boolean h00=false;
|
||||
private static boolean h01=false;
|
||||
@@ -15,33 +17,77 @@ public class HardewareManipulate {
|
||||
switch(c){
|
||||
case '0':
|
||||
h00=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '1':
|
||||
h01=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '2':
|
||||
h02=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '3':
|
||||
h03=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '4':
|
||||
h04=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '5':
|
||||
h05=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '6':
|
||||
h06=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '7':
|
||||
h07=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '8':
|
||||
h08=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
case '9':
|
||||
h09=true;
|
||||
HardwareResetTimers.setManipulated(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void resetHardware(char c){
|
||||
switch(c){
|
||||
case '0':
|
||||
h00=false;
|
||||
break;
|
||||
case '1':
|
||||
h01=false;
|
||||
break;
|
||||
case '2':
|
||||
h02=false;
|
||||
break;
|
||||
case '3':
|
||||
h03=false;
|
||||
break;
|
||||
case '4':
|
||||
h04=false;
|
||||
break;
|
||||
case '5':
|
||||
h05=false;
|
||||
break;
|
||||
case '6':
|
||||
h06=false;
|
||||
break;
|
||||
case '7':
|
||||
h07=false;
|
||||
break;
|
||||
case '8':
|
||||
h08=false;
|
||||
break;
|
||||
case '9':
|
||||
h09=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user