コード例 #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);
 }