DelayNoMore/frontend/assets/scripts/ControlledCharacter.js

47 lines
996 B
JavaScript
Raw Normal View History

const AttackingCharacter = require("./AttackingCharacter");
2022-09-20 15:50:01 +00:00
cc.Class({
extends: AttackingCharacter,
2022-09-20 15:50:01 +00:00
properties: {
arrowTipNode: {
type: cc.Node,
default: null
},
coordLabel: {
type: cc.Label,
default: null
2022-09-20 15:50:01 +00:00
}
},
onLoad() {
AttackingCharacter.prototype.onLoad.call(this);
2022-09-20 15:50:01 +00:00
this.arrowTipNode.active = false;
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;
window.setTimeout(function() {
2022-09-20 15:50:01 +00:00
if (null == self.arrowTipNode) {
return;
}
self.arrowTipNode.active = false;
}, 3000)
},
update(dt) {
AttackingCharacter.prototype.update.call(this, dt);
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
},
});