// TODO: this should be parameterized further and read from config public override SimulationScenario GenerateScenario() { #region configuration #region graph var nodeLeft = new NodeConfig() { Name = "00", X = 0, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var nodeMiddle = new NodeConfig() { Name = "10", X = 1, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var nodeRight = new NodeConfig() { Name = "20", X = 2, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var nodeAntivirus = new NodeConfig() { Name = "11", X = 1, Y = 1, Archetype = TutorialAntivirusWorkstation.Archetype, }; var nodeConfigs = new NodeConfig[] { nodeLeft, nodeRight, nodeMiddle, nodeAntivirus }; ConfigurationHelper.ProcessNodeConfigs(nodeConfigs); var edgeConfigs = ConfigurationHelper.GenerateFullyConnectedConfiguration(nodeConfigs, 1); #endregion var archetypes = new List <Archetype> { TutorialSubsystem.Archetype, ConnectionNode.Archetype, Player.Archetype, ScannerTool.Archetype, TutorialScanner.Archetype, TutorialCapture.Archetype, TutorialAntivirusWorkstation.Archetype, AnalyserActivator.Archetype, AntivirusTool.Archetype, RedTutorialVirus.Archetype, VisibleGreenTutorialVirus.Archetype, TutorialText.Archetype, }; var configuration = ConfigurationHelper.GenerateConfiguration(nodeConfigs, edgeConfigs, null, archetypes); configuration.RNGSeed = 897891658; #endregion var scenario = new SimulationScenario(ScenarioInfo) { Configuration = configuration, PlayerConfigFactory = new StartingLocationSequencePlayerConfigFactory(Player.Archetype, new [] { nodeRight.Id }), // TODO: need a config driven specification for these Sequence = new List <SequenceFrame <Simulation, SimulationConfiguration> >(), }; #region frames // 1 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateItem(ScannerTool.Archetype, nodeRight), new ShowText(true, $"{scenario.Key}_Frame1"), new CreateMalware(RedTutorialVirus.Archetype, nodeLeft), }, ExitCondition = new WaitForTutorialContinue().Or(new GenomeRevealedAtLocation(nodeLeft, SimulationConstants.MalwareGeneRed)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 2 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetHighlight(nodeAntivirus), new ShowText(true, $"{scenario.Key}_Frame2"), }, ExitCondition = new WaitForTutorialContinue().Or(new GenomeRevealedAtLocation(nodeLeft, SimulationConstants.MalwareGeneRed)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), }, } ); // 3 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetHighlight(nodeLeft), new ShowText(false, $"{scenario.Key}_Frame3"), }, ExitCondition = new GenomeRevealedAtLocation(nodeLeft, SimulationConstants.MalwareGeneRed), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), }, } ); // 4 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateItem(TutorialCapture.Archetype, nodeAntivirus), new ShowText(true, $"{scenario.Key}_Frame4"), }, ExitCondition = new ItemTypeIsInInventory <Capture>().Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 5 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame5"), }, ExitCondition = new PlayerIsAtLocation(nodeAntivirus).Or(new ItemTypeIsInInventory <Capture>()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 6 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame6"), }, ExitCondition = EvaluatorExtensions.Not(new ItemTypeIsInInventory <Scanner>()).Or(new ItemTypeIsInInventory <Capture>()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 7 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame7"), }, ExitCondition = new ItemTypeIsInInventory <Capture>(), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), }, } ); // 8 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame8"), }, ExitCondition = new PlayerIsAtLocation(nodeLeft).Or(new GenomeIsCaptured(SimulationConstants.MalwareGeneRed)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 9 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame9"), }, ExitCondition = new GenomeIsCaptured(SimulationConstants.MalwareGeneRed), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 10 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame10"), }, ExitCondition = new PlayerIsAtLocation(nodeAntivirus).And(new ItemTypeIsInInventory <Capture>()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 11 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame11"), }, ExitCondition = new ItemTypeIsInStorageAtLocation <Antivirus>(nodeAntivirus), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 12 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame12"), }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(nodeLeft)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 13 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateMalware(VisibleGreenTutorialVirus.Archetype, nodeLeft), new CreateMalware(VisibleGreenTutorialVirus.Archetype, nodeMiddle), new CreateMalware(VisibleGreenTutorialVirus.Archetype, nodeRight), new ShowText(true, $"{scenario.Key}_Frame13"), }, ExitCondition = new WaitForTutorialContinue().Or(EvaluatorExtensions.Not(new IsInfected())), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 14 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame14"), }, ExitCondition = new EntityDisposed <Malware>().Or(EvaluatorExtensions.Not(new IsInfected())), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 15 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame15"), }, ExitCondition = EvaluatorExtensions.Not(new IsInfected()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 16 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new WaitForTicks(5), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EndGame(EndGameState.Success), }, } ); #endregion configuration.LifeCycleConfiguration.TickInterval = 100; return(scenario); }
// TODO: this should be parameterized further and read from config public override SimulationScenario GenerateScenario() { #region configuration #region graph var nodeLeft = new NodeConfig() { Name = "00", X = 0, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var nodeRight = new NodeConfig() { Name = "10", X = 1, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var nodeConfigs = new NodeConfig[] { nodeLeft, nodeRight }; ConfigurationHelper.ProcessNodeConfigs(nodeConfigs); var edgeConfigs = ConfigurationHelper.GenerateFullyConnectedConfiguration(nodeConfigs, 1); #endregion var archetypes = new List <Archetype> { TutorialSubsystem.Archetype, ConnectionNode.Archetype, Player.Archetype, TutorialScanner.Archetype, RedTutorialAntivirus.Archetype, RedTutorialVirus.Archetype, TutorialText.Archetype, }; var configuration = ConfigurationHelper.GenerateConfiguration(nodeConfigs, edgeConfigs, null, archetypes); configuration.RNGSeed = 282581594; #endregion var scenario = new SimulationScenario(ScenarioInfo) { Configuration = configuration, PlayerConfigFactory = new StartingLocationSequencePlayerConfigFactory(Player.Archetype, new[] { nodeRight.Id }), Sequence = new List <SequenceFrame <Simulation, SimulationConfiguration> >(), }; #region frames // 1 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(true, $"{scenario.Key}_Frame1") }, ExitCondition = new PlayerDestinarionIs(nodeLeft).Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new SetCommandEnabled <SetActorDestinationCommand>(true), }, } ); // 2 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame2") }, ExitCondition = new PlayerDestinarionIs(nodeLeft), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 3 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame3"), }, ExitCondition = new PlayerIsAtLocation(nodeLeft), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 4 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { // TODO: this should disable the cancapture flag of the inventory slot new SetCommandEnabled <PickupItemCommand>(false), new SetCommandEnabled <ActivateItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), new CreateItem(TutorialScanner.Archetype, nodeRight), new ShowText(true, $"{scenario.Key}_Frame4"), }, ExitCondition = new PlayerIsAtLocation(nodeRight).Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), }, } ); // 5 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame5"), }, ExitCondition = new PlayerIsAtLocation(nodeRight), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 6 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <ActivateItemCommand>(true), new SetCommandEnabled <DropAndActivateItemCommand>(true), new ShowText(false, $"{scenario.Key}_Frame6"), }, ExitCondition = new ItemTypeIsActivated <Scanner>(), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 7 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateMalware(RedTutorialVirus.Archetype, nodeLeft), new ShowText(true, $"{scenario.Key}_Frame7"), new SetCommandEnabled <PickupItemCommand>(true), }, ExitCondition = new ItemTypeIsInInventory <Scanner>().Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 8 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <PickupItemCommand>(true), new ShowText(false, $"{scenario.Key}_Frame8") }, ExitCondition = new ItemTypeIsInInventory <Scanner>(), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new SetCommandEnabled <DropItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), }, } ); // 9 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame9"), }, ExitCondition = new PlayerIsAtLocation(nodeLeft), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(false), new HideText(), }, } ); // 10 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <DropItemCommand>(true), new SetCommandEnabled <DropAndActivateItemCommand>(true), new ShowText(false, $"{scenario.Key}_Frame10"), }, ExitCondition = new ItemTypeIsInStorageAtLocation <Scanner>(nodeLeft), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(true), new HideText(), }, } ); // 11 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame11"), new SetCommandEnabled <SetActorDestinationCommand>(false), }, ExitCondition = new GenomeRevealedAtLocation(nodeLeft), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(true), new HideText(), }, } ); // 12 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame12"), new SetCommandEnabled <ActivateItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), new CreateItem(RedTutorialAntivirus.Archetype, nodeRight), }, ExitCondition = new ItemTypeIsInInventory <Antivirus>(), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <DropItemCommand>(false), new SetCommandEnabled <PickupItemCommand>(false), new SetCommandEnabled <SwapInventoryItemCommand>(false), new SetCommandEnabled <SwapInventoryItemAndActivateCommand>(false), new ClearHighlight(), }, } ); // 13 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new PlayerIsAtLocation(nodeLeft), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(false), new SetCommandEnabled <DropItemCommand>(true), new SetCommandEnabled <DropAndActivateItemCommand>(true), new SetCommandEnabled <SwapInventoryItemCommand>(true), new SetCommandEnabled <SwapInventoryItemAndActivateCommand>(true), new SetCommandEnabled <ActivateItemCommand>(true), }, } ); // 13 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(nodeLeft)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 14 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new WaitForTicks(5), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EndGame(EndGameState.Success), }, } ); #endregion return(scenario); }
// TODO: this should be parameterized further and read from config public override SimulationScenario GenerateScenario() { #region configuration #region graph var nodeT1 = new NodeConfig() { Name = "00", X = 0, Y = 0, Archetype = TransferWorkstation.Archetype, }; var node10 = new NodeConfig() { Name = "10", X = 1, Y = 0, Archetype = SubsystemNode.Archetype, }; var node01 = new NodeConfig() { Name = "01", X = 0, Y = 1, Archetype = SubsystemNode.Archetype, }; var node11 = new NodeConfig() { Name = "11", X = 1, Y = 1, Archetype = SubsystemNode.Archetype, }; var node21 = new NodeConfig() { Name = "21", X = 2, Y = 1, Archetype = SubsystemNode.Archetype, }; var node30 = new NodeConfig() { Name = "30", X = 3, Y = 0, Archetype = SubsystemNode.Archetype, }; var node31 = new NodeConfig() { Name = "31", X = 3, Y = 1, Archetype = SubsystemNode.Archetype, }; var node40 = new NodeConfig() { Name = "40", X = 4, Y = 0, Archetype = SubsystemNode.Archetype, }; var nodeT2 = new NodeConfig() { Name = "41", X = 4, Y = 1, Archetype = TransferWorkstation.Archetype, }; var nodeConfigs = new NodeConfig[] { nodeT1, node10, node01, node11, node21, node30, node31, node40, nodeT2, }; ConfigurationHelper.ProcessNodeConfigs(nodeConfigs); var edgeConfigs = ConfigurationHelper.GenerateFullyConnectedConfiguration(nodeConfigs, 1); edgeConfigs = edgeConfigs.Where(e => !(e.Source == nodeT1.Id && e.Destination == node10.Id) && !(e.Source == node10.Id && e.Destination == nodeT1.Id)).ToList(); #endregion var archetypes = new List <Archetype> { SubsystemNode.Archetype, ConnectionNode.Archetype, TransferWorkstation.Archetype, TransferActivator.Archetype, Player.Archetype, TutorialNPC.Archetype, ScannerTool.Archetype, RedTutorialAntivirus.Archetype, VisibleRedTutorialVirus.Archetype, GreenTutorialAntivirus.Archetype, VisibleGreenTutorialVirus.Archetype, TutorialText.Archetype, }; var configuration = ConfigurationHelper.GenerateConfiguration(nodeConfigs, edgeConfigs, null, archetypes); configuration.RNGSeed = 477359007; #endregion var scenario = new SimulationScenario(ScenarioInfo) { Configuration = configuration, PlayerConfigFactory = new StartingLocationSequencePlayerConfigFactory(Player.Archetype, new[] { node40.Id }), Sequence = new List <SequenceFrame <Simulation, SimulationConfiguration> >(), }; #region frames // 1 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateMalware(VisibleRedTutorialVirus.Archetype, node10), new CreateMalware(VisibleRedTutorialVirus.Archetype, node01), new CreateMalware(VisibleRedTutorialVirus.Archetype, node11), new CreateMalware(VisibleGreenTutorialVirus.Archetype, node21), new CreateMalware(VisibleGreenTutorialVirus.Archetype, node30), new CreateMalware(VisibleGreenTutorialVirus.Archetype, node31), new ShowText(true, $"{scenario.Key}_Frame1") }, ExitCondition = new PlayerIsAtLocation(nodeT1).Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 2 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(true, $"{scenario.Key}_Frame2") }, ExitCondition = new PlayerIsAtLocation(nodeT1).Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 3 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateItem(GreenTutorialAntivirus.Archetype, nodeT1), new SetCommandEnabled <ActivateItemCommand>(false), new ShowText(false, $"{scenario.Key}_Frame3") }, ExitCondition = new PlayerIsAtLocation(nodeT1) .And(new ItemTypeIsInInventory <Antivirus>(filter: new AntivirusGenomeFilter(SimulationConstants.MalwareGeneGreen)).Or(new ItemTypeIsInStorageAtLocation <Antivirus, TransferItemContainer>(nodeT1))), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), new SetCommandEnabled <DropItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), new SetCommandEnabled <SetActorDestinationCommand>(false), }, } ); // 4 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateItem(RedTutorialAntivirus.Archetype, nodeT2, typeof(TransferItemContainer)), new SetCommandEnabled <MoveItemCommand>(false), new ShowText(true, $"{scenario.Key}_Frame4"), }, ExitCondition = new ItemTypeIsInStorageAtLocation <Antivirus, TransferItemContainer>(nodeT1).Or(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), }, } ); // 5 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <DropItemCommand>(true), new ShowText(false, $"{scenario.Key}_Frame5"), }, ExitCondition = new ItemTypeIsInStorageAtLocation <Antivirus, TransferItemContainer>(nodeT1), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <PickupItemCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), }, } ); // 6 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new ItemTypeIsInStorageAtLocation <Antivirus, TransferItemContainer>(nodeT2, new AntivirusGenomeFilter(SimulationConstants.MalwareGeneGreen)) .And(new ItemTypeIsInStorageAtLocation <Antivirus, TransferItemContainer>(nodeT1, new AntivirusGenomeFilter(SimulationConstants.MalwareGeneRed))), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new SetCommandEnabled <PickupItemCommand>(true), new SetCommandEnabled <MoveItemCommand>(true), new SetCommandEnabled <DropItemCommand>(false), }, } ); // 7 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame7"), }, ExitCondition = new WaitForTicks(1), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreatePlayer(TutorialNPC.Archetype, nodeT2, "Colleague"), new SetCommandEnabled <ActivateItemCommand>(false), }, } ); #region NPC behaviour // 8 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(true), }, ExitCondition = new WaitForTicks(10), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new PickupItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetDestination(node30, 1), }, } ); scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new ItemTypeIsInInventory <Antivirus>().And(new PlayerIsAtLocation(node01)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), new SetCommandEnabled <DropAndActivateItemCommand>(true), new SetCommandEnabled <DropItemCommand>(true), }, } ); scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(node01)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(true), new SetCommandEnabled <ActivateItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), new SetCommandEnabled <DropItemCommand>(false), }, } ); // 9 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <DropItemCommand>(true), }, ExitCondition = new PlayerIsAtLocation(node30, 1), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new DropItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetCommandEnabled <DropItemCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), }, } ); // 10 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new ActivateItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetCommandEnabled <SetActorDestinationCommand>(true), }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(node30)).And(new WaitForTicks(1)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <ActivateItemCommand>(false), new EnqueuePlayerCommand(new PickupItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetDestination(node31, 1), }, } ); scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new ItemTypeIsInInventory <Antivirus>().And(new PlayerIsAtLocation(node11)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), new SetCommandEnabled <DropAndActivateItemCommand>(true), new SetCommandEnabled <DropItemCommand>(true), }, } ); scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(node11)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(true), new SetCommandEnabled <ActivateItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), new SetCommandEnabled <DropItemCommand>(false), }, } ); // 11 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <DropItemCommand>(true), }, ExitCondition = new PlayerIsAtLocation(node31, 1), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new DropItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetCommandEnabled <DropItemCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), }, } ); // 12 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new ActivateItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetCommandEnabled <SetActorDestinationCommand>(true), }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(node31)).And(new WaitForTicks(1)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <ActivateItemCommand>(false), new EnqueuePlayerCommand(new PickupItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetDestination(node21, 1), }, } ); scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new ItemTypeIsInInventory <Antivirus>().And(new PlayerIsAtLocation(node10)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), new SetCommandEnabled <DropAndActivateItemCommand>(true), new SetCommandEnabled <DropItemCommand>(true), }, } ); scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(node10)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(true), new SetCommandEnabled <ActivateItemCommand>(false), new SetCommandEnabled <DropAndActivateItemCommand>(false), new SetCommandEnabled <DropItemCommand>(false), }, } ); // 13 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <DropItemCommand>(true), }, ExitCondition = new PlayerIsAtLocation(node21, 1), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new DropItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), new SetCommandEnabled <DropItemCommand>(false), new SetCommandEnabled <ActivateItemCommand>(true), }, } ); // 14 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new ActivateItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, // TODO: find the npc player id automatically }), }, ExitCondition = EvaluatorExtensions.Not(new IsInfected()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <ActivateItemCommand>(false), new HideText(), }, } ); #endregion // 15 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new WaitForTicks(5), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EndGame(EndGameState.Success), }, } ); #endregion return(scenario); }
// TODO: this should be parameterized further and read from config public override SimulationScenario GenerateScenario() { #region configuration #region graph var node00 = new NodeConfig() { Name = "00", X = 0, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var node10 = new NodeConfig() { Name = "10", X = 1, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var node20 = new NodeConfig() { Name = "20", X = 2, Y = 0, Archetype = TutorialSubsystem.Archetype, }; var node01 = new NodeConfig() { Name = "01", X = 0, Y = 1, Archetype = TutorialSubsystem.Archetype, }; var node11 = new NodeConfig() { Name = "11", X = 1, Y = 1, Archetype = AntivirusWorkstation.Archetype, }; var node21 = new NodeConfig() { Name = "21", X = 2, Y = 1, Archetype = TutorialSubsystem.Archetype, }; var nodeConfigs = new NodeConfig[] { node00, node10, node20, node01, node11, node21, }; ConfigurationHelper.ProcessNodeConfigs(nodeConfigs); var connection0010 = new EdgeConfig(node00.Id, EdgeDirection.East, node10.Id, ConnectionNode.Archetype); var connection1000 = connection0010.Reciprocate(); var connection1020 = new EdgeConfig(node10.Id, EdgeDirection.East, node20.Id, ConnectionNode.Archetype); var connection2010 = connection1020.Reciprocate(); var connection1011 = new EdgeConfig(node10.Id, EdgeDirection.South, node11.Id, ConnectionNode.Archetype); var connection1110 = connection1011.Reciprocate(); var connection0111 = new EdgeConfig(node01.Id, EdgeDirection.East, node11.Id, ConnectionNode.Archetype); var connection1101 = connection0111.Reciprocate(); var connection1121 = new EdgeConfig(node11.Id, EdgeDirection.East, node21.Id, ConnectionNode.Archetype); var connection2111 = connection1121.Reciprocate(); var edgeConfigs = new EdgeConfig[] { connection0010, connection1000, connection1020, connection2010, connection1011, connection1110, connection0111, connection1101, connection1121, connection2111, }; #endregion var archetypes = new List <Archetype> { TutorialSubsystem.Archetype, ConnectionNode.Archetype, AntivirusWorkstation.Archetype, TutorialCapture.Archetype, AnalyserActivator.Archetype, Player.Archetype, AntivirusTool.Archetype, VisibleRedTutorialVirus.Archetype, VisibleGreenTutorialVirus.Archetype, TutorialText.Archetype, TutorialNPC.Archetype, }; var configuration = ConfigurationHelper.GenerateConfiguration(nodeConfigs, edgeConfigs, null, archetypes); configuration.RNGSeed = 2007196112; #endregion var scenario = new SimulationScenario(ScenarioInfo) { Configuration = configuration, PlayerConfigFactory = new StartingLocationSequencePlayerConfigFactory(Player.Archetype, new[] { node21.Id }), Sequence = new List <SequenceFrame <Simulation, SimulationConfiguration> >(), }; #region frames // 1 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateMalware(VisibleRedTutorialVirus.Archetype, node00), new ShowText(true, $"{scenario.Key}_Frame1") }, ExitCondition = new WaitForTutorialContinue(), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 2 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetHighlight(node10), new CreateMalware(VisibleRedTutorialVirus.Archetype, connection0010), new ShowText(true, $"{scenario.Key}_Frame2") }, ExitCondition = new IsInfected(node10) .And(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 3 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateMalware(VisibleRedTutorialVirus.Archetype, connection0010), new ShowText(true, $"{scenario.Key}_Frame3") }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(connection0010)) .And(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 4 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateMalware(VisibleGreenTutorialVirus.Archetype, node20), new CreateMalware(VisibleGreenTutorialVirus.Archetype, connection2010), new ShowText(true, $"{scenario.Key}_Frame4") }, ExitCondition = new IsInfected(node10, new MalwareGenomeFilter(SimulationConstants.MalwareGeneRed | SimulationConstants.MalwareGeneGreen)) .And(new WaitForTutorialContinue()), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ClearHighlight(), new HideText(), }, } ); // 5 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreateItem(TutorialCapture.Archetype, node11), new ShowText(false, $"{scenario.Key}_Frame5") }, ExitCondition = new PlayerIsAtLocation(node10).And(new ItemTypeIsActivated <Capture>(activationState: ActivationState.Deactivating)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new ClearHighlight(), }, } ); // 6 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetCommandEnabled <SetActorDestinationCommand>(false), new SetCommandEnabled <PickupItemCommand>(false), new ShowText(true, $"{scenario.Key}_Frame6") }, ExitCondition = new WaitForTutorialContinue(), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 7 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ShowText(false, $"{scenario.Key}_Frame7"), }, ExitCondition = new ItemTypeIsActivated <Capture>(activationState: ActivationState.Deactivating), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), new SetCommandEnabled <SetActorDestinationCommand>(true), new SetCommandEnabled <PickupItemCommand>(true), }, } ); // 8 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new SetHighlight(node10), new ShowText(false, $"{scenario.Key}_Frame8") }, ExitCondition = new ItemTypeIsInStorageAtLocation <Antivirus>(node10, new AntivirusGenomeFilter(SimulationConstants.MalwareGeneGreen)) .And(new ItemTypeIsInStorageAtLocation <Antivirus>(node10, new AntivirusGenomeFilter(SimulationConstants.MalwareGeneRed))), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 9 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new CreatePlayer(TutorialNPC.Archetype, node10, "Colleague"), new ShowText(false, $"{scenario.Key}_Frame9") }, ExitCondition = new ItemTypeIsActivated <Antivirus>(node10), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new ClearHighlight(), }, } ); // 10 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EnqueuePlayerCommand(new ActivateItemTypeCommand() { ItemType = typeof(Antivirus), PlayerId = 1, }), }, ExitCondition = EvaluatorExtensions.Not(new IsInfected(node10)), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new HideText(), }, } ); // 11 scenario.Sequence.Add( new SimulationFrame() { OnEnterActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { }, ExitCondition = new WaitForTicks(5), OnExitActions = new List <ECSAction <Simulation, SimulationConfiguration> >() { new EndGame(EndGameState.Success), }, } ); #endregion return(scenario); }