예제 #1
0
        public override async Task <IStateChange> Attempt(HackingAttemptState initialState)
        {
            await Speech.SayAllOf(IntroText);

            await Task.Delay(_pause);

            return(StateChange.NoChange);
        }
예제 #2
0
        public HackingAttemptState AppliedTo(HackingAttemptState PriorState)
        {
            var state = PriorState;

            foreach (IStateChange change in this)
            {
                state = change.AppliedTo(state);
            }
            return(state);
        }
예제 #3
0
            public virtual bool IsAvailable(HackingAttemptState state)
            {
                if (!state.Conditions.ContainsKey(conditionString))
                {
                    return(false);
                }

                var result = state.Conditions[conditionString];

                return((negateResult) ? !result : result);
            }
예제 #4
0
        public HackingAttemptState AppliedTo(HackingAttemptState PriorState)
        {
            var resultState = PriorState;

            if (Constraint(ChangeTo, PriorState))
            {
                resultState[ChangeTo] = ChangeTo;
            }

            return(resultState);
        }
예제 #5
0
 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);
 }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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;
            }
        }
예제 #9
0
        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());
        }
예제 #10
0
 public virtual bool IsAvailable(HackingAttemptState state)
 {
     return(Criterion(Benchmark, state));
 }
예제 #11
0
            //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);
            }
예제 #12
0
 public HackingAttemptState AppliedTo(HackingAttemptState PriorState)
 {
     NodeNarrative.SwitchToNarrative(_nextNarrative);
     return(PriorState);
 }
예제 #13
0
 public HackingAttemptState AppliedTo(HackingAttemptState PriorState)
 {
     return(_changeEffect?.Invoke(PriorState) ?? PriorState);
 }
예제 #14
0
 public NodeNarrative(HackingAttemptState initialState = null, params ActionOpportunity[] opportunities)
 {
     AttemptState = initialState ?? new HackingAttemptState();
     Opportunities.AddRange(opportunities);
 }