1
0
Fork 0

Removed drone once destroyed

This commit is contained in:
Michaël Lemaire 2017-08-25 01:02:32 +02:00
parent 9016af3fff
commit 1f8eb2d86d
7 changed files with 13 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -33,7 +33,7 @@ module TS.SpaceTac {
let result = new ExclusionAreas(battle.width, battle.height);
result.hard_border = battle.border;
result.hard_obstacle = battle.ship_separation;
let obstacles = imap(ifilter(battle.iships(), ship => !contains(ignore_ships, ship)), ship => ship.location);
let obstacles = imap(ifilter(battle.iships(true), ship => !contains(ignore_ships, ship)), ship => ship.location);
result.configure(imaterialize(obstacles), soft_distance);
return result;
}

View file

@ -190,6 +190,7 @@ module TS.SpaceTac.UI {
*/
changeImage(image: Phaser.Image, name: string): void {
let info = this.getImageInfo(name);
image.name = name;
image.loadTexture(info.key);
image.frame = info.frame;
}

View file

@ -99,11 +99,11 @@ module TS.SpaceTac.UI.Specs {
bar.power.children.forEach((child, idx) => {
let img = <Phaser.Image>child;
if (idx < available) {
expect(img.data.frame).toEqual(0);
expect(img.name).toEqual("battle-actionbar-power-available");
} else if (idx < available + using) {
expect(img.data.frame).toEqual(2);
expect(img.name).toEqual("battle-actionbar-power-move");
} else {
expect(img.data.frame).toEqual(1);
expect(img.name).toEqual("battle-actionbar-power-used");
}
});
}

View file

@ -21,9 +21,6 @@ module TS.SpaceTac.UI {
// Duration info
duration: Phaser.Text
// Destroyed state
destroyed = false
constructor(battleview: BattleView, drone: Drone) {
super(battleview.game);
@ -57,7 +54,7 @@ module TS.SpaceTac.UI {
this.add(this.duration);
this.view.tooltip.bindDynamicText(this.sprite, () => {
return this.destroyed ? "" : this.drone.getDescription();
return this.drone.getDescription();
});
}
@ -67,10 +64,6 @@ module TS.SpaceTac.UI {
* Return the animation duration
*/
setApplied(): number {
if (this.destroyed) {
return 0;
}
this.activation.scale.set(0.001, 0.001);
this.activation.visible = true;
let tween = this.game.tweens.create(this.activation.scale).to({ x: 1, y: 1 }, 500);
@ -83,14 +76,11 @@ module TS.SpaceTac.UI {
* Set the sprite as destroyed
*/
setDestroyed() {
this.destroyed = true;
this.game.tweens.create(this).to({ alpha: 0.3 }, 300).delay(200).start();
let tween = this.game.tweens.create(this.radius.scale).to({ x: 0, y: 0 }, 500);
tween.onComplete.addOnce(() => {
this.radius.destroy();
this.activation.destroy();
this.destroy();
});
tween.start();
}

View file

@ -224,11 +224,8 @@ module TS.SpaceTac.UI {
* This will alter the HUD frame to show this state
*/
setPlaying(playing: boolean) {
if (this.ship.alive) {
this.frame.alpha = playing ? 1 : 0.35;
} else {
this.frame.alpha = 0;
}
this.frame.alpha = playing ? 1 : 0.35;
this.frame.visible = this.ship.alive;
}
/**
@ -240,6 +237,7 @@ module TS.SpaceTac.UI {
}
this.setPlaying(false);
this.battleview.animations.setVisible(this.stasis, dead, 400);
this.alpha = dead ? 0.3 : 1;
}
/**

View file

@ -25,9 +25,9 @@ module TS.SpaceTac.UI.Specs {
expect(content.children[0].name).toBe("ship-fake-portrait");
expect(content.children[1].text).toBe("Phil's Level 1 Fury");
expect(content.children[2].text).toBe("Plays in 2 turns");
expect(content.children[3].text).toBe("Hull\n58");
expect(content.children[4].text).toBe("Shield\n140");
expect(content.children[5].text).toBe("Power\n12");
expect(content.children[3].text).toBe("Hull\n58/58");
expect(content.children[4].text).toBe("Shield\n140/140");
expect(content.children[5].text).toBe("Power\n12/12");
expect(content.children[6].text).toBe("Active effects");
expect(content.children[7].text).toBe("• limit precision to 10");
expect(content.children[8].text).toBe("• damage -15% for 3 turns");