Every time I start a battle, I receive an ORK.Battle.BattleEnded callback. In my console, the stack is:
UnityEngine.Debug:Log(Object)
PlayerCharCTRL:ORKEndBattle() (at Assets/Scripts/PlayerCharCTRL.cs:1044)
ORKFramework.Battle:DoEndBattle(BattleOutcome)
ORKFramework.Battle:ClearBattle()
ORKFramework.Behaviours.BattleComponent:StartBattle()
ORKFramework.Behaviours.BattleComponent:StartEvent(GameObject)
ORKFramework.Behaviours.BattleComponent:StartGroup(Group, IEventStarter)
ORKFramework.Behaviours.CombatantComponent:Update()
It is weird that DoEndBattle appears in the same stack as StartBattle isn't it?
Also, at the end of my battles, I get 3 ORK.Battle.BattleEnded callbacks in a row. The stacks are the following:
#1PlayerCharCTRL:ORKEndBattle() (at Assets/Scripts/PlayerCharCTRL.cs:1044)
ORKFramework.Battle:DoEndBattle(BattleOutcome)
ORKFramework.Battle:BattleVictory()
ORKFramework.Battle:Tick()
ORKFramework.ORKCore:FireTick()
ORKFramework.ORKHandler:Update()
#2PlayerCharCTRL:ORKEndBattle() (at Assets/Scripts/PlayerCharCTRL.cs:1044)
ORKFramework.Battle:DoEndBattle(BattleOutcome)
ORKFramework.Battle:ClearBattle()
ORKFramework.ControlHandler:SetInBattle(Int32)
ORKFramework.Behaviours.BattleComponent:EventEnded()
ORKFramework.Events.BattleEndEvent:EndEvent()
ORKFramework.Events.BattleEndEvent:ExecuteNextStep()
ORKFramework.Events.BaseEvent:StepFinished(Int32)
ORKFramework.Events.Steps.ShowBattleGridStep:Execute(BaseEvent)
ORKFramework.Events.BattleEndEvent:ExecuteNextStep()
ORKFramework.Events.BaseEvent:StepFinished(Int32)
ORKFramework.Events.BaseEvent:Tick(Single)
ORKFramework.Behaviours.BattleComponent:Update()
#3PlayerCharCTRL:ORKEndBattle() (at Assets/Scripts/PlayerCharCTRL.cs:1044)
ORKFramework.Battle:DoEndBattle(BattleOutcome)
ORKFramework.Battle:ClearBattle()
ORKFramework.Behaviours.BattleComponent:EventEnded()
ORKFramework.Events.BattleEndEvent:EndEvent()
ORKFramework.Events.BattleEndEvent:ExecuteNextStep()
ORKFramework.Events.BaseEvent:StepFinished(Int32)
ORKFramework.Events.Steps.ShowBattleGridStep:Execute(BaseEvent)
ORKFramework.Events.BattleEndEvent:ExecuteNextStep()
ORKFramework.Events.BaseEvent:StepFinished(Int32)
ORKFramework.Events.BaseEvent:Tick(Single)
ORKFramework.Behaviours.BattleComponent:Update()
I wonder why this is, as I have no control over this.
if(BattleOutcome.None != ORK.Battle.Outcome)
in your function before doing anything.
This is also called when the battle system is reset (e.g. before or after a battle), in which case the battle's outcome is None.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!