2022-11-19 12:58:07 +00:00
|
|
|
const AttackingCharacter = require("./AttackingCharacter");
|
2022-09-20 15:50:01 +00:00
|
|
|
|
|
|
|
cc.Class({
|
2022-11-19 12:58:07 +00:00
|
|
|
extends: AttackingCharacter,
|
2022-09-20 15:50:01 +00:00
|
|
|
properties: {
|
|
|
|
arrowTipNode: {
|
|
|
|
type: cc.Node,
|
|
|
|
default: null
|
2022-11-12 12:34:38 +00:00
|
|
|
},
|
|
|
|
coordLabel: {
|
|
|
|
type: cc.Label,
|
|
|
|
default: null
|
2023-02-08 08:15:05 +00:00
|
|
|
},
|
|
|
|
hpBar: {
|
|
|
|
type: cc.ProgressBar,
|
|
|
|
default: null
|
|
|
|
},
|
2022-09-20 15:50:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onLoad() {
|
2022-11-19 12:58:07 +00:00
|
|
|
AttackingCharacter.prototype.onLoad.call(this);
|
2022-09-20 15:50:01 +00:00
|
|
|
this.arrowTipNode.active = false;
|
2022-11-13 04:52:17 +00:00
|
|
|
|
|
|
|
if (!this.mapIns.showCriticalCoordinateLabels) {
|
|
|
|
this.coordLabel.node.active = false;
|
|
|
|
}
|
2022-09-20 15:50:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
showArrowTipNode() {
|
|
|
|
const self = this;
|
|
|
|
if (null == self.arrowTipNode) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self.arrowTipNode.active = true;
|
2022-11-12 12:34:38 +00:00
|
|
|
window.setTimeout(function() {
|
2022-09-20 15:50:01 +00:00
|
|
|
if (null == self.arrowTipNode) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self.arrowTipNode.active = false;
|
|
|
|
}, 3000)
|
|
|
|
},
|
|
|
|
|
|
|
|
update(dt) {
|
2022-11-19 12:58:07 +00:00
|
|
|
AttackingCharacter.prototype.update.call(this, dt);
|
2022-11-12 12:34:38 +00:00
|
|
|
if (this.mapIns.showCriticalCoordinateLabels) {
|
|
|
|
this.coordLabel.string = `(${this.node.x.toFixed(2)}, ${this.node.y.toFixed(2)})`;
|
|
|
|
}
|
2022-09-20 15:50:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
});
|