private void getFood(PlayerStatus aPlayer, int aFood, Action aCallback) { if (aFood != 0) { MySoundPlayer.playSe("decision22"); } aPlayer.mFood += aFood; sortPlayerRank(); GameAnimation.getFood(mElement.mPlayerStatusDisplay[aPlayer.mPlayerNumber], aFood, aCallback); }
private void lostFood(PlayerStatus aPlayer, int aFood, Action aCallback) { if (aFood != 0) { MySoundPlayer.playSe("decision14"); } aPlayer.mFood -= aFood; sortPlayerRank(); GameAnimation.getFood(mElement.mPlayerStatusDisplay[aPlayer.mPlayerNumber], -aFood, () => { if (aPlayer.mFood >= 0) { aCallback(); } else { endanger(aPlayer, aCallback); } }); }
private void moveFood(PlayerStatus aGetter, PlayerStatus aPayer, int aFood, Action aCallback) { MySoundPlayer.playSe("decision14"); aGetter.mFood += aFood; aPayer.mFood -= aFood; sortPlayerRank(); CallbackSystem tSystem = new CallbackSystem(); GameAnimation.getFood(mElement.mPlayerStatusDisplay[aGetter.mPlayerNumber], aFood, tSystem.getCounter()); GameAnimation.getFood(mElement.mPlayerStatusDisplay[aPayer.mPlayerNumber], -aFood, tSystem.getCounter()); tSystem.then(() => { if (aPayer.mFood < 0) { endanger(aPayer, aCallback); return; } aCallback(); }); }