fix animations

This commit is contained in:
ntr 2018-12-31 17:25:46 +11:00
parent d7f4400a1b
commit 3095a8723b
2 changed files with 5 additions and 4 deletions

View File

@ -65,7 +65,6 @@ class CombatHitBox extends Phaser.Scene {
t.cryps.forEach((c) => { t.cryps.forEach((c) => {
const cback = () => { const cback = () => {
const { activeSkill } = skillScene; const { activeSkill } = skillScene;
console.log(activeSkill);
if (activeSkill) { if (activeSkill) {
activeSkill.activate(); activeSkill.activate();
skillScene.activeSkill = null; skillScene.activeSkill = null;
@ -75,7 +74,6 @@ class CombatHitBox extends Phaser.Scene {
const crypSpawn = group.children.entries.find(s => s.cryp.id === c.id); const crypSpawn = group.children.entries.find(s => s.cryp.id === c.id);
const team = c.account === account.id ? 0 : 1; const team = c.account === account.id ? 0 : 1;
console.log(crypSpawn);
this.add.existing(new CrypHitBox(this, crypSpawn.iter, team, cback)); this.add.existing(new CrypHitBox(this, crypSpawn.iter, team, cback));
}); });
}); });

View File

@ -7,13 +7,14 @@ const {
} = require('./constants'); } = require('./constants');
function findResolutionCryps(scene, group, resolution, game) { function findResolutionCryps(scene, group, resolution, game) {
const sourceCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.source_cryp_id)) const sourceCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.source_cryp_id))
.cryps.find(c => c.id === resolution.source_cryp_id); .cryps.find(c => c.id === resolution.source_cryp_id);
const sourceSpawn = group.children.entries.find(c => c.cryp.id === sourceCryp.id); const sourceSpawn = group.children.entries.find(c => c.cryp.id === sourceCryp.id);
const targetCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.target_cryp_id)) const targetCryp = game.teams.find(t => t.cryps.find(c => c.id === resolution.target_cryp_id))
.cryps.find(c => c.id === resolution.target_cryp_id); .cryps.find(c => c.id === resolution.target_cryp_id);
const targetSpawn = group.children.entries.find(c => c.cryp.id === targetCryp.id); const targetSpawn = group.children.entries.find(c => c.cryp.id === targetCryp.id);
return { sourceSpawn, targetSpawn }; return { sourceSpawn, targetSpawn };
@ -52,6 +53,7 @@ function animatePhase(scene, game, resolution, cb) {
// Find cryps, targets // Find cryps, targets
const { sourceSpawn, targetSpawn } = findResolutionCryps(scene, group, resolution, game); const { sourceSpawn, targetSpawn } = findResolutionCryps(scene, group, resolution, game);
const { const {
moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig, moveSourceBattle, moveSourceOrig, moveTargetBattle, moveTargetOrig,
} = calculateTweenParams(sourceSpawn, targetSpawn, account); } = calculateTweenParams(sourceSpawn, targetSpawn, account);
@ -72,7 +74,8 @@ function animatePhase(scene, game, resolution, cb) {
scene.tweens.add(moveTargetBattle); scene.tweens.add(moveTargetBattle);
return scene.time.delayedCall(MOVE_CREEP, () => { return scene.time.delayedCall(MOVE_CREEP, () => {
const isAlly = resolution.target_team_id !== account.id; const isAlly = sourceSpawn.cryp.account === account.id;
// animate animation // animate animation
const workingSkills = ['Heal', 'Block']; const workingSkills = ['Heal', 'Block'];
if (workingSkills.includes(resolution.skill)) animations.getSkill(resolution.skill, isAlly, castLocation); if (workingSkills.includes(resolution.skill)) animations.getSkill(resolution.skill, isAlly, castLocation);