[rework] add base game class
This commit is contained in:
4
src/common/haxe/ru/m/tankz2/Id.hx
Normal file
4
src/common/haxe/ru/m/tankz2/Id.hx
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package ru.m.tankz2;
|
||||||
|
|
||||||
|
typedef PlayerId = Int;
|
||||||
|
typedef TeamId = String;
|
||||||
27
src/common/haxe/ru/m/tankz2/config/Config.hx
Normal file
27
src/common/haxe/ru/m/tankz2/config/Config.hx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package ru.m.tankz2.config;
|
||||||
|
|
||||||
|
typedef MapConfig = {
|
||||||
|
var grid:{
|
||||||
|
width:Int,
|
||||||
|
height:Int,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef TankConfig = {
|
||||||
|
var width:Float;
|
||||||
|
var height:Float;
|
||||||
|
var speed:Float;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef PlayerConfig = {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef TeamConfig = {
|
||||||
|
var players:Array<PlayerConfig>;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef Config = {
|
||||||
|
var map:MapConfig;
|
||||||
|
var teams:Array<TeamConfig>;
|
||||||
|
}
|
||||||
11
src/common/haxe/ru/m/tankz2/game/Game.hx
Normal file
11
src/common/haxe/ru/m/tankz2/game/Game.hx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package ru.m.tankz2.game;
|
||||||
|
|
||||||
|
import ru.m.tankz2.state.State;
|
||||||
|
|
||||||
|
class Game {
|
||||||
|
public var state(default, null):State;
|
||||||
|
|
||||||
|
public function new(state:State) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/common/haxe/ru/m/tankz2/game/Team.hx
Normal file
17
src/common/haxe/ru/m/tankz2/game/Team.hx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package ru.m.tankz2.game;
|
||||||
|
|
||||||
|
import ru.m.tankz2.config.Config;
|
||||||
|
import ru.m.tankz2.Id;
|
||||||
|
import ru.m.tankz2.state.State;
|
||||||
|
|
||||||
|
class Team {
|
||||||
|
public var id(default, default):TeamId;
|
||||||
|
public var config(default, default):TeamConfig;
|
||||||
|
public var state(default, default):TeamState;
|
||||||
|
|
||||||
|
public function new(id:TeamId, config:TeamConfig, state:TeamState) {
|
||||||
|
this.id = id;
|
||||||
|
this.config = config;
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/common/haxe/ru/m/tankz2/state/State.hx
Normal file
13
src/common/haxe/ru/m/tankz2/state/State.hx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package ru.m.tankz2.state;
|
||||||
|
|
||||||
|
import ru.m.tankz2.config.Config;
|
||||||
|
|
||||||
|
typedef TeamState = {
|
||||||
|
var alive:Bool;
|
||||||
|
var life:Null<Int>;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef State = {
|
||||||
|
var config:Config;
|
||||||
|
var teams:Array<TeamState>;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user