class BonusSpeed extends Bonus {
    constructor(name = "", scene, x, y, value, time) {
        let bonus;
        switch (value) {
            case 1:
                bonus = 'bonusSpeed0';
                break;
            case 2:
                bonus = 'bonusSpeed1';
                break;
            case 3:
                bonus = 'bonusSpeed2';
                break;
            default:
                bonus = 'bonusSpeed2';
                break;
        }
        super(name, scene, x, y, bonus, value);
        this.time = time;
    }

    useOn(robot) {
        robot.increaseSpeedBonus(this.value);
        this.scene.time.addEvent({delay: this.time, callback: () => robot.decreaseSpeedBonus(this.value)});
        this.destroy();
    }
}