コード例 #1
0
        public static CombatEncounterController GetInstance()
        {
            if (instance == null)
            {
                instance = new CombatEncounterController();
            }

            return(instance);
        }
コード例 #2
0
        /// <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);
        }