public override async Task <IStateChange> Attempt(HackingAttemptState initialState) { await Speech.SayAllOf(IntroText); await Task.Delay(_pause); return(StateChange.NoChange); }
public HackingAttemptState AppliedTo(HackingAttemptState PriorState) { var state = PriorState; foreach (IStateChange change in this) { state = change.AppliedTo(state); } return(state); }
public virtual bool IsAvailable(HackingAttemptState state) { if (!state.Conditions.ContainsKey(conditionString)) { return(false); } var result = state.Conditions[conditionString]; return((negateResult) ? !result : result); }
public HackingAttemptState AppliedTo(HackingAttemptState PriorState) { var resultState = PriorState; if (Constraint(ChangeTo, PriorState)) { resultState[ChangeTo] = ChangeTo; } return(resultState); }
public override async Task <IStateChange> Attempt(HackingAttemptState initialState) { if (persist) { await Task.WhenAll(_soundEffect.PlayToCompletion(), Task.Delay(Duration)); } else { await Task.WhenAny(_soundEffect.PlayToCompletion(), Task.Delay(Duration)); } return(StateChange.NoChange); }
public virtual async Task <IStateChange> Attempt(HackingAttemptState initialState) { await Speech.SayAllOf(IntroText, useSpeakerMode : false); // Generate possible Outcomes (lists of StateChanges) here, based on the specifics of what the player is doing. // Also, remember to set reTryPossible on the returned Outcome, if you want it to indeed be an option. // If relevant the special stateChanges for dumping the hacker or switching to another system should probably be the // last state changes in the outcome stack. return(StateChange.NoChange); }
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 override async Task <IStateChange> Attempt(HackingAttemptState initialState) { var MostRecentSample = new Sequence <Vector2>(); //// Watch for the "key" gestures here; if detected, launch the associated ICEbreaker and await its results. //var featureVectors = (new MachineLearningActivity.MachineLearningStage("", null, null)).StopAndReturnResults(); // Change!!! //MostRecentSample.SourcePath = featureVectors; int selectionIndex = -1; if (Classifier.MachineOnline) { //selectionIndex = await Classifier.Recognize(MostRecentSample); // TODO - fix this up for DatapointKitchenSink type Classifier... } if (selectionIndex == -1) { return(StateChange.NoChange); } ChosenBreaker = SuitableBreakers[selectionIndex]; return(await ChosenBreaker.Break()); }
public virtual bool IsAvailable(HackingAttemptState state) { return(Criterion(Benchmark, state)); }
//private static int DeclarationIndex = 0; //private static int NextIndex { get { return System.Threading.Interlocked.Increment(ref DeclarationIndex); } } public virtual bool IsAvailable(HackingAttemptState givenState) { return(true); }
public HackingAttemptState AppliedTo(HackingAttemptState PriorState) { NodeNarrative.SwitchToNarrative(_nextNarrative); return(PriorState); }
public HackingAttemptState AppliedTo(HackingAttemptState PriorState) { return(_changeEffect?.Invoke(PriorState) ?? PriorState); }
public NodeNarrative(HackingAttemptState initialState = null, params ActionOpportunity[] opportunities) { AttemptState = initialState ?? new HackingAttemptState(); Opportunities.AddRange(opportunities); }