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.
42 lines
858 B
42 lines
858 B
package visualiser.gameController.Keys;
|
|
|
|
import network.Messages.Enums.BoatActionEnum;
|
|
import visualiser.model.ThisBoat;
|
|
|
|
/**
|
|
* Key to toggle the sails
|
|
*/
|
|
public class SailsToggleKey extends ControlKey {
|
|
|
|
/**
|
|
* Constructor for Control
|
|
*/
|
|
public SailsToggleKey() {
|
|
super("Toggle Sails", BoatActionEnum.NOT_A_STATUS);
|
|
}
|
|
|
|
/**
|
|
* Toggle command associated with sails key
|
|
*/
|
|
@Override
|
|
public void onAction() {
|
|
if(ThisBoat.getInstance().isSailsOut()) {
|
|
protocolCode = BoatActionEnum.SAILS_IN;
|
|
ThisBoat.getInstance().setSailsOut(false);
|
|
} else {
|
|
protocolCode = BoatActionEnum.SAILS_OUT;
|
|
ThisBoat.getInstance().setSailsOut(true);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onHold() {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onRelease() {
|
|
|
|
}
|
|
}
|