Exemplo n.º 1
0
        public override async Task <IStateChange> Attempt(HackingAttemptState initialState)
        {
            await Speech.SayAllOf(IntroText);

            await Task.Delay(_pause);

            return(StateChange.NoChange);
        }
Exemplo n.º 2
0
        public HackingAttemptState AppliedTo(HackingAttemptState PriorState)
        {
            var state = PriorState;

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

                var result = state.Conditions[conditionString];

                return((negateResult) ? !result : result);
            }
Exemplo n.º 4
0
        public HackingAttemptState AppliedTo(HackingAttemptState PriorState)
        {
            var resultState = PriorState;

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

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