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.

41 lines
762 B

package visualiser.gameController.Keys;
import network.Messages.Enums.BoatActionEnum;
/**
* Key to toggle the sails
*/
public class SailsToggleKey extends ControlKey {
/**
* Constructor for Control
* @param name name of the key
*
*/
public SailsToggleKey(String name) {
super(name, BoatActionEnum.SAILS_IN);
}
/**
* Toggle command associated with sails key
*/
@Override
public void onAction() {
if(protocolCode == BoatActionEnum.SAILS_IN) {
protocolCode = BoatActionEnum.SAILS_OUT;
} else {
protocolCode = BoatActionEnum.SAILS_IN;
}
}
@Override
public void onHold() {
}
@Override
public void onRelease() {
}
}