public static CombatEncounterController GetInstance() { if (instance == null) { instance = new CombatEncounterController(); } return(instance); }
/// <summary> /// Handle the attack between 2 combatants /// </summary> public static void HandleAttack(ref Unit attacker, int atkEqpSlot, ref Unit defender, int defEqpSlot) { EncounterData eData = CombatEncounterController.GetInstance().CurrentEncounter; eData.AddLog("ATTACK"); ApplyDamage(ref attacker, atkEqpSlot, ref defender, eData); // Unit is dead so no counter attack. if (defender.hp <= 0) { return; } eData.AddLog("COUNTER-ATTACK"); ApplyDamage(ref defender, defEqpSlot, ref attacker, eData); }