private void DefineContext(PhaseList list) { AbilityContext.instance = this; AbilityContext.phaseList = list; AbilityContext.originator = m_Originator; AbilityContext.target = m_Target; }
public void ScheduleList() { PhaseList list = AbilityContext.instance.IDToPhaseList(id); if (list != null) { AbilityContext.instance.RunList(list); } }
public void RunList() { PhaseList list = AbilityContext.instance.IDToPhaseList(id); if (list != null) { list.OnUpdate(); } }
internal void RunList(PhaseList list) { for (int p = 0; p < phaseLists.Length; p++) { if (phaseLists[p] == list) { m_LastList.Push(p); return; } } }
internal PhaseList Clone() { PhaseList clone = new PhaseList(id); clone.title = title; clone.instant = instant; clone.m_CurrentPhase = m_CurrentPhase; clone.phases = new Phases.PhaseCore[phases.Length]; for (int p = 0; p < phases.Length; p++) { clone.phases[p] = ScriptableObject.Instantiate <Phases.PhaseCore>(phases[p]); } return(clone); }
private void Update() { if (isDying && IsDead()) { Reset(); return; } if (!isUpdating || isDying) { return; } PhaseList list = phaseLists[m_LastList.Peek()]; DefineContext(list); Result result = list.OnUpdate(); switch (result) { case Result.Success: m_LastList.Pop(); // If default list is finished init ability dying if (m_LastList.Count <= 0) { isDying = true; return; } break; case Result.Running: // If the list was instant then rerun if (list.instant) { Update(); } break; case Result.Fail: isDying = true; break; } }