public HackingAttemptState AppliedTo(HackingAttemptState PriorState) { NodeNarrative.EndCurrentNarrative(); if (FXafterSpeech) { Speech.SayAllOf(DumpSpeech, useSpeakerMode: false).Wait(); DumpSFX?.Play(useSpeakers: true); } else { DumpSFX?.Play(useSpeakers: true); Speech.Say(DumpSpeech, useSpeakerMode: false); } return(PriorState); }
public async Task RunIt(HackingAttemptState initialState = null) { AttemptState = initialState ?? AttemptState; var CurrentOpportunity = NextOpportunity; while (CurrentOpportunity != default(ActionOpportunity)) { var outcome = CurrentOpportunity.Attempt(AttemptState); if (await outcome.Before(CurrentOpportunity.MaxOpportunityWindow, _endNarrativeSignal.Task)) { AttemptState = outcome.Result.AppliedTo(AttemptState); if (!outcome.Result.reTryPermitted) { CurrentOpportunity.AlreadyPresented = true; CurrentOpportunity = NextOpportunity; } } else { if (_endNarrativeSignal.Task.Status == TaskStatus.RanToCompletion) { CurrentOpportunity = default(ActionOpportunity); break; } CurrentOpportunity.AlreadyPresented = true; CurrentOpportunity = NextOpportunity; } } if (_endNarrativeSignal.Task.Status == TaskStatus.RanToCompletion && _nextNarrative != null) { var nextNar = _nextNarrative; _nextNarrative = null; _endNarrativeSignal = new TaskCompletionSource(); await nextNar.RunIt(AttemptState); return; } }
public HackingAttemptState AppliedTo(HackingAttemptState PriorState) { NodeNarrative.SwitchToNarrative(_nextNarrative); return(PriorState); }
public JumpToNewNarrativePath(NodeNarrative newNarrative) { _nextNarrative = newNarrative; }
public static void SwitchToNarrative(NodeNarrative nextNarrative) { _nextNarrative = nextNarrative; _endNarrativeSignal.SetResult(); }