[common] add GameProgress
This commit is contained in:
22
src/common/haxe/ru/m/tankz/game/GameProgress.hx
Normal file
22
src/common/haxe/ru/m/tankz/game/GameProgress.hx
Normal file
@@ -0,0 +1,22 @@
|
||||
package ru.m.tankz.game;
|
||||
|
||||
import ru.m.tankz.Type.GameType;
|
||||
|
||||
class GameProgress {
|
||||
|
||||
public var type(default, null):GameType;
|
||||
private var completed(default, null):Map<Int, Bool>;
|
||||
|
||||
public function new(type:GameType) {
|
||||
this.type = type;
|
||||
this.completed = new Map();
|
||||
}
|
||||
|
||||
public function isLevelAvailable(level:Int):Bool {
|
||||
return level == 0 || completed.get(level - 1);
|
||||
}
|
||||
|
||||
public function completeLevel(level:Int):Void {
|
||||
completed.set(level, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user