private float getReceivedDamage(BattleAction fighterAction, BattleAction opponentAction) { BattleActionResults bars = DataManager.Instance.BattleActionResults[fighterAction.ActionType]; float receivedDamage = 0; foreach (var bar in bars.BattleActionResultList) { if (bar.ActionType == opponentAction.ActionType) { receivedDamage = bar.ReceivingDamage; } } return(receivedDamage); }
private void ProcessTurn() { PreviousBattleActions = battleActions; foreach (KeyValuePair <int, BattleAction> entry in battleActions) { FighterController fc = FighterControllers[entry.Key]; fc.ActionRenderer.sprite = DataManager.Instance.BattleActionIcons[entry.Value.ActionType]; FighterController targetFC = FighterControllers[entry.Value.Target]; BattleActionResults bars = DataManager.Instance.BattleActionResults[entry.Value.ActionType]; float receivedDamage = 0; foreach (var bar in bars.BattleActionResultList) { if (bar.ActionType == battleActions[entry.Value.Target].ActionType) { receivedDamage = bar.ReceivingDamage; } } fc.Health -= receivedDamage; } DelayUtil.WaitForSeconds(TurnCooldownSeconds + 1, () => { foreach (KeyValuePair <int, BattleAction> entry in battleActions) { FighterControllers[entry.Key].ClearActionIcon(); } battleActions = new Dictionary <int, BattleAction>(); Dictionary <int, float> healthFighters = new Dictionary <int, float>(); foreach (KeyValuePair <int, FighterController> entry in FighterControllers) { healthFighters.Add(entry.Key, entry.Value.Health); } int loser = GetRoundLoser(healthFighters); if (loser >= 0) { RoundEnd(loser, FighterControllers); } else { turnInProgress = false; } }); }