import State from '../state'
import config from '../../config'
import keys from '../../cgt/inputs/keyboard'
import screen from './screen'

class EnemyState extends State {
    init() {

    }

    prepare() {
        screen.setText( [ 'Враг готовится', 'нанести удар', 'A: далее' ] )
        screen.setMarker( -1 )

        this.waitKeyA = keys.get('A')
    }

    draw(ctx) {
        screen.render(ctx)
    }

    update() {
        if (this.waitKeyA) {
            if (keys.get('A')) return
            this.waitKeyA = false
        }

        if (keys.get('A')) {
            this.emit('done')
        }
    }
}

export default EnemyState
