[common] added PlayerState

This commit is contained in:
2018-02-20 17:23:53 +03:00
parent 5b04242aab
commit 2e856c1256
16 changed files with 135 additions and 126 deletions

View File

@@ -69,7 +69,7 @@ class GameFrame extends VGroupView implements ViewBuilder implements IPacketHand
}
private function stateString(game:Game):String {
if (game.state == null) {
if (game == null) {
return '';
}
var result:Array<String> = [];
@@ -77,12 +77,12 @@ class GameFrame extends VGroupView implements ViewBuilder implements IPacketHand
for (team in game.teams) {
if (game.state.loser == team.id) {
result.push('${team.id}: LOSE');
} else if (team.life > -1) {
} else if (team.life > 0) {
result.push('${team.id}: ${team.life}');
} else {
for (player in team.players) {
if (player.life > -1) {
result.push('${player.id.team}${player.id.index}: ${player.life}');
if (player.state.life > 0) {
result.push('${player.id.team}${player.id.index}: ${player.state.life}');
}
}
}

View File

@@ -96,6 +96,7 @@ class Render extends SpriteView implements EngineListener {
clearLayer(entryLayer);
clearLayer(groundLayer);
clearLayer(upLayer);
clearLayer(upperLayer);
}
public function onSpawn(entity:EntityType):Void {

View File

@@ -21,25 +21,26 @@ player:
human: &human
control: human
life: 3
protect: 5
tanks:
- {type: human0, rate: 1, protect: 5}
- {type: human0, rate: 1}
bot: &bot
control: bot
color: 0xFFFFFF
life: -1
bonus: 0.25
tanks:
- {type: bot0, rate: 0.25, bonus: 0.25}
- {type: bot1, rate: 0.25, bonus: 0.25}
- {type: bot2, rate: 0.25, bonus: 0.25}
- {type: bot3, rate: 0.25, bonus: 0.25}
- {type: bot0, rate: 0.25}
- {type: bot1, rate: 0.25}
- {type: bot2, rate: 0.25}
- {type: bot3, rate: 0.25}
presets:
# player1
- id: player1
teams:
- id: human
life: -1
players:
- {<<: *human, index: 0, color: 0xF5C040, life: 3}
- {<<: *human, index: 0, color: 0xFFFF00}
- id: bot
spawnInterval: 3000
life: 20
@@ -48,14 +49,13 @@ presets:
- {<<: *bot, index: 1}
- {<<: *bot, index: 2}
- {<<: *bot, index: 3}
# player2
- id: player2
teams:
- id: human
life: -1
players:
- {<<: *human, index: 0, color: 0xF5C040, life: 3}
- {<<: *human, index: 1, color: 0x15C040, life: 3}
- {<<: *human, index: 0, color: 0xFFFF00}
- {<<: *human, index: 1, color: 0x15C040}
- id: bot
spawnInterval: 3000
life: 20
@@ -117,6 +117,7 @@ tanks:
- type: human3
upgrade: human3
downgrade: human2
width: 42
height: 38
speed: 2.9
@@ -125,7 +126,6 @@ tanks:
speed: 9.0
piercing: 3
bullets: 2
hits: 1
skin: pd
- type: bot0

View File

@@ -17,34 +17,42 @@ bricks:
- {type: armor, index: 4, layer: 2, armor: 2}
- {type: brick, index: 5, layer: 2, armor: 1}
player:
base: &player
control: bot
protect: 3
tanks:
- {type: slow, rate: 0.5}
- {type: fast, rate: 0.5}
human1: &human1
<<: *player
control: human
color: 0xf055a0
human2: &human2
<<: *player
control: human
color: 0xa055f0
team:
base: &team
life: 20
players:
- {<<: *player, index: 0}
- {<<: *player, index: 1}
- {<<: *player, index: 2}
- {<<: *player, index: 3}
- {<<: *player, index: 4}
radiant: &radiant
id: radiant
color: 0xff4422
life: 20
<<: *team
dire: &dire
id: dire
color: 0x2244ff
life: 20
player: &player
life: -1
control: bot
tanks:
- {type: slow, rate: 0.5, protect: 3, bonus: 0}
- {type: fast, rate: 0.5, protect: 3, bonus: 0}
human1: &human1
<<: *player
control: human
color: 0xf055a0
human2: &human2
<<: *player
control: human
color: 0xa055f0
<<: *team
presets:
# player1
- id: player1
teams:
- <<: *radiant
@@ -55,12 +63,7 @@ presets:
- {<<: *player, index: 3}
- {<<: *player, index: 4}
- <<: *dire
players:
- {<<: *player, index: 0}
- {<<: *player, index: 1}
- {<<: *player, index: 2}
- {<<: *player, index: 3}
- {<<: *player, index: 4}
# player2_coop
- id: player2_coop
teams:
- <<: *radiant
@@ -71,12 +74,7 @@ presets:
- {<<: *player, index: 3}
- {<<: *player, index: 4}
- <<: *dire
players:
- {<<: *player, index: 0}
- {<<: *player, index: 1}
- {<<: *player, index: 2}
- {<<: *player, index: 3}
- {<<: *player, index: 4}
# player2_vs
- id: player2_vs
teams:
- <<: *radiant