23 lines
663 B
Haxe
23 lines
663 B
Haxe
package ru.m.tankz.control;
|
|
|
|
import ru.m.tankz.bot.StupidBotControl;
|
|
import ru.m.tankz.bot.HardBotControl;
|
|
import ru.m.tankz.Type;
|
|
|
|
class ClientControlFactory implements IControlFactory {
|
|
|
|
public function new() {}
|
|
|
|
public function build(id:PlayerId, controller:Controller):Control {
|
|
return switch controller {
|
|
case HUMAN(index): new HumanControl(id, index);
|
|
case BOT(type): switch type {
|
|
case StupidBotControl.BOT_TYPE: new StupidBotControl(id);
|
|
case HardBotControl.BOT_TYPE: new HardBotControl(id);
|
|
case _: null;
|
|
}
|
|
case NONE: null;
|
|
}
|
|
}
|
|
}
|