package io.anuke.mindustry.entities.units;

public class StateMachine{
    private UnitState state;

    public void update(){
        if(state != null) state.update();
    }

    public void set(UnitState next){
        if(next == state) return;
        if(state != null) state.exited();
        this.state = next;
        if(next != null) next.entered();
    }

    public boolean is(UnitState state){
        return this.state == state;
    }
}
