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() {

    }
}
