mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 10:09:44 +02:00
56 lines
2.0 KiB
Java
56 lines
2.0 KiB
Java
package de.heatup.ui.actionPanel;
|
|
|
|
import java.awt.Component;
|
|
import java.awt.event.KeyAdapter;
|
|
import java.awt.event.KeyEvent;
|
|
import java.util.Random;
|
|
|
|
import javax.swing.JLabel;
|
|
|
|
import de.heatup.mapengine.MapEngine;
|
|
import de.heatup.mapengine.MapGrid;
|
|
import de.heatup.mapengine.MapGridCell;
|
|
import de.heatup.testing.GameLoopD;
|
|
|
|
public class ActionWatcher{
|
|
private static boolean action = false;
|
|
private static boolean setAction = false;
|
|
private static boolean infoText =false;
|
|
|
|
public static void setAction(boolean b){
|
|
action = b;
|
|
}
|
|
public static boolean getAction(){
|
|
return action;
|
|
}
|
|
public static void tick(){
|
|
//Infotext, wenn man in der nähe von einem Hardwareteil steht
|
|
if(MapGrid.getGridCell(GameLoopD.player01.getGridLocation().x, GameLoopD.player01.getGridLocation().y).isTrigger() && !action && !setAction){
|
|
infoText=true;
|
|
if(!HardewareManipulate.getHardware(MapGrid.getGridCell(GameLoopD.player01.getGridLocation().x, GameLoopD.player01.getGridLocation().y).getCorrespondingHardwareToTrigger())){
|
|
ActionControl.setTextforA();
|
|
}else{
|
|
ActionControl.setTextforManipulate();
|
|
}
|
|
}
|
|
//Entfernt InfoText
|
|
if(!MapGrid.getGridCell(GameLoopD.player01.getGridLocation().x, GameLoopD.player01.getGridLocation().y).isTrigger() && infoText){
|
|
ActionControl.resetActionPanel();
|
|
infoText=false;
|
|
}
|
|
//Leitet das Manipulieren ein, nachdem man das "A" gedrückt hat. Es kommt entweder Smashing oder Keysequence Text.
|
|
if(action&&!setAction){
|
|
setAction=true;
|
|
ActionControl.resetActionPanel();
|
|
ActionControl.setAction(new Random().nextInt(2)+1);
|
|
}
|
|
//Entfernt jeglichen Text wenn man sich von dem Hardwarestück entfernt, nachdem Aktion bereits eingeleitet wurde, und setzt Booleans/Counter wieder auf die Ausgangssituation
|
|
if(!MapGrid.getGridCell(GameLoopD.player01.getGridLocation().x, GameLoopD.player01.getGridLocation().y).isTrigger() && setAction){
|
|
ActionControl.resetActionPanel();
|
|
infoText=false;
|
|
setAction=false;
|
|
action=false;
|
|
}
|
|
}
|
|
}
|