Drafted anti-air attack for Monk.

This commit is contained in:
genxium
2023-01-11 22:24:31 +08:00
parent 934a495d47
commit 71a5a7b727
11 changed files with 286 additions and 133 deletions

View File

@@ -15,6 +15,7 @@ window.ATK_CHARACTER_STATE = {
Atk2: [11, "Atk2"],
Atk3: [12, "Atk3"],
Atk4: [13, "Atk4"],
Atk5: [14, "Atk5"],
};
window.ATK_CHARACTER_STATE_ARR = [];

View File

@@ -7,20 +7,33 @@ cc.Class({
this.speciesName = null;
},
setSpecies(speciesName) {
setSpecies(speciesName, fireballBullet, rdf) {
if (speciesName == this.speciesName) return;
this.speciesName = speciesName;
this.effAnimNode = this.node.getChildByName(this.speciesName);
this.animComp = this.effAnimNode.getComponent(cc.Animation);
this.effAnimNode.active = true;
for (let k in this.children) {
const child = this.children[k];
if (!child.active) continue;
if (child == effAnimNode || child.name == speciesName) continue;
child.active = false;
const child = this.children[k];
if (!child.active) continue;
if (child == effAnimNode || child.name == speciesName) continue;
child.active = false;
}
this.updateAnim(speciesName, fireballBullet, rdf);
},
onLoad() {
onLoad() {},
updateAnim(speciesName, fireballBullet, rdf) {
// Update directions
if (this.animComp && this.animComp.node) {
if (0 > fireballBullet.DirX) {
this.effAnimNode.scaleX = (-1.0);
} else if (0 < fireballBullet.DirX) {
this.effAnimNode.scaleX = (1.0);
}
}
this.animComp.play(speciesName);
},
});

View File

@@ -1067,7 +1067,7 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
}
},
_renderFireballBullet(fireballBullet) {
_renderFireballBullet(fireballBullet, rdf) {
const self = this;
let pqNode = self.cachedFireballs.popAny(fireballBullet.Bullet.BulletLocalId);
const speciesName = `Fireball${fireballBullet.SpeciesId}`;
@@ -1078,7 +1078,7 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
console.log(`Using a cached fireball node for rendering for bulletLocalId=${fireballBullet.Bullet.BulletLocalId}`);
}
const cachedFireball = pqNode.value;
cachedFireball.setSpecies(speciesName);
cachedFireball.setSpecies(speciesName, fireballBullet, rdf);
cachedFireball.lastUsed = self.renderFrameId;
cachedFireball.bulletLocalId = fireballBullet.Bullet.BulletLocalId;
@@ -1111,7 +1111,9 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
const fireballBullets = rdf.FireballBullets;
for (let k in fireballBullets) {
const fireballBullet = fireballBullets[k];
self._renderFireballBullet(fireballBullet);
if ((fireballBullet.Bullet.OriginatedRenderFrameId + fireballBullet.Bullet.StartupFrames <= rdf.Id) && (fireballBullet.Bullet.OriginatedRenderFrameId + fireballBullet.Bullet.StartupFrames + fireballBullet.Bullet.ActiveFrames > rdf.Id)) {
self._renderFireballBullet(fireballBullet, rdf);
}
}
// Update countdown