private void level(StageBuilder builder, int monsters = 0, int items = 0, List <string> breeds = null, List <Rarity> drop = null, QuestBuilder quest = null ) { if (quest == null) { quest = _currentQuest; } var breedList = new List <Breed>(); foreach (var name in breeds) { var breed = BreedFactory.Instance.Breeds[name]; if (breed == null) { throw new ApplicationException($"Could not find breed '{name}'"); } breedList.Add(breed); } _currentArea.Levels.Add( new Level( (stage) => builder.Generate(stage), monsters, items, DropFactory.dropOneOf(drop), breedList, quest) ); }
/// <summary> /// Populates the custom stage selection dropdown /// </summary> private void InitializeCustomStageSelectionDropdown() { if (Dropdown != null) { Dropdown.options.Clear(); // Create a dropdown option for each stage in the stage list List <string> stageList = StageBuilder.GetStageListFromResources(); foreach (string stage in stageList) { Dropdown.OptionData optionData = new Dropdown.OptionData(stage); Dropdown.options.Add(optionData); } // If a stage is currently active, select that stage by default, otherwise select index zero if (CustomGameManager.CurrentStage != null) { Dropdown.value = StageBuilder.GetStageListFromResources().IndexOf(CustomGameManager.CurrentStage.StageName); } else { Dropdown.value = 0; } // Update the dropdown to show the latest selected value Dropdown.RefreshShownValue(); } }
//Populates the Game's data using info/functions from GameData; void Start() { LoadResources(); hitmanager = GetComponent <HitManager>(); stagebuilder = GetComponent <StageBuilder>(); player1 = SpawnMorganis(); player1.playerNum = 1; player2 = SpawnExamplePlayer(new Vector3(5, -2.25F)); player2.playerNum = 2; PlayerAttackManager.nullAttackLists.Add(player1.nullify); PlayerAttackManager.nullAttackLists.Add(player2.nullify); //not needed for now /*GameObject HUI =*/ Instantiate(healthUI); GameObject damageCounter1 = GameObject.Find("Player1Health"); GameObject damageCounter2 = GameObject.Find("Player2Health"); damageCounter1.GetComponent <DamageCounter>().damageSource = player1; damageCounter2.GetComponent <DamageCounter>().damageSource = player2; stagebuilder.ConstructFlat(); }
internal void ComposeStage(GameObject cellPrefab, GameObject blockPrefab, Transform container, StageBuilder stageBuilder) { //1. 스테이지 구성에 필요한 Cell,Block, Container(Board) 정보를 저장한다. m_CellPrefab = cellPrefab; m_BlockPrefab = blockPrefab; m_Container = container; m_StageBuilder = stageBuilder; //2. 3매치된 블럭이 없도록 섞는다. BoardShuffler shuffler = new BoardShuffler(this, true); shuffler.Shuffle(); //3. Cell, Block Prefab을 이용해서 Board에 Cell/Block GameObject를 추가한다. float initX = CalcInitX(0.5f); float initY = CalcInitY(0.5f); for (int nRow = 0; nRow < m_nRow; nRow++) { for (int nCol = 0; nCol < m_nCol; nCol++) { //3.1 Cell GameObject 생성을 요청한다.GameObject가 생성되지 않는 경우에 null을 리턴한다. Cell cell = m_Cells[nRow, nCol]?.InstantiateCellObj(cellPrefab, container); cell?.Move(initX + nCol, initY + nRow); //3.2 Block GameObject 생성을 요청한다. // GameObject가 생성되지 않는 경우에 null을 리턴한다. EMPTY 인 경우에 null Block block = m_Blocks[nRow, nCol]?.InstantiateBlockObj(blockPrefab, container); block?.Move(initX + nCol, initY + nRow); } } }
public Sunstroke() { Name = "Sunstroke"; IsDynamic = true; Stages = new List <DiseaseStage>(new[] { StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.InitialStage) .SelfHealChance(20) .Vitals .WithTargetBodyTemperature(37.1f) .WillReachTargetsInHours(1) .AndLastForHours(3) .AdditionalEffects .WithLowChanceOfSneeze() .NoDisorders() .NoDrains() .Treatment .WithConsumable((gc, cunsumable, disease) => { return(false); }) .AndWithoutSpecialItems() .Build() }); }
// Use this for initialization void Start() { m_target = GameObject.FindGameObjectWithTag("Player"); m_cab = this.GetComponent<CabController> (); m_stage = GameObject.FindGameObjectWithTag(m_StageTag).GetComponent<StageBuilder>(); m_audio = gameObject.GetComponent<AudioSource>(); m_horn_pitch = (Random.Range(0, 2) == 0) ? 1.0f : 1.1f; m_vertman = Random.Range(0, 2) == 0; }
public void Get_ReleaseWithStageAndStepFound_ReleaseWithStageAndStepReturned() { //Arrange var request = new GetReleasesHttpRequestMessageBuilder().Build(); var expectedRelease = new ReleaseBuilder().Build(); var expectedEnvironment = new EnvironmentBuilder().Build(); var expectedStage = new StageBuilder().ForEnvironment(expectedEnvironment).Build(); var expectedStep = new StepBuilder() .ForRelease(expectedRelease) .ForStage(expectedStage) .Build(); var expectedDeploymentStep = new DeploymentStepBuilder() .ForRelease(expectedRelease) .ForStage(expectedStage) .ForStep(expectedStep) .Build(); var dataModel = new DataModelBuilder() .WithRelease(expectedRelease) .WithEnvironment(expectedEnvironment) .WithStage(expectedStage) .WithStageWorkflowFor(expectedRelease, expectedStage) .WithStep(expectedStep) .WithDeploymentStep(expectedDeploymentStep) .Build(); _releaseRepositoryMock.Setup((stub) => stub.GetReleaseData(It.IsAny <string>(), It.IsAny <int>())) .Returns(dataModel); //Act dynamic result = _sut.Get(request); //Assert Assert.IsNotNull(result, "Unexpected result"); Assert.IsInstanceOfType(result.releases, typeof(List <dynamic>), "Unexpected type for releases collection"); Assert.AreEqual(1, result.releases.Count, "Unexpected number of releases"); var actualRelease = result.releases[0]; AssertAreReleasesEqual(expectedRelease, actualRelease); Assert.IsInstanceOfType(actualRelease.stages, typeof(List <dynamic>), "Unexpected type for stages collection"); Assert.AreEqual(1, actualRelease.stages.Count, "Unexpected number of stages for release"); var actualStage = actualRelease.stages[0]; AssertAreStagesEqual(expectedStage, expectedEnvironment, actualStage); Assert.IsInstanceOfType(actualStage.steps, typeof(List <dynamic>), "Unexpected type for steps collection"); Assert.AreEqual(1, actualStage.steps.Count, "Unexpected number of steps for stage"); var actualStep = actualStage.steps[0]; AssertAreStepsEqual(expectedStep, actualStep); Assert.IsInstanceOfType(actualStep.deploymentSteps, typeof(List <dynamic>), "Unexpected type for deploymentStep collection"); Assert.AreEqual(1, actualStep.deploymentSteps.Count, "Unexpected number of steps for deploymentSteps"); AssertAreDeploymentStepsEqual(expectedDeploymentStep, actualStep.deploymentSteps[0]); }
// Use this for initialization void Start () { m_stage = GameObject.FindGameObjectWithTag(m_StageTag).GetComponent<StageBuilder>(); m_stage.PrepareStage(); m_time = 0.0f; m_preparing = true; int num = (int)(3.0f / m_Interval); for (int i = 0; i < num; i++) { buildVehicle(); } m_preparing = false; }
//----------------------------------------------------- // //----------------------------------------------------- void OnGUI() { using (new EditorGUILayout.HorizontalScope()) { stageData = (StageData)EditorGUILayout.ObjectField("StageData", stageData, typeof(StageData), true); if (GUILayout.Button("New", GUILayout.Width(50))) { Debug.Log("ここから過程大事に"); } } EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); { toolType = (ToolType)GUILayout.Toolbar((int)toolType, new string[] { "Tile3D", "Stage" }, (GUIStyle)"OL Titlemid"); } if (EditorGUI.EndChangeCheck()) { if (toolType == ToolType.Tile3D) { if (tiler == null) { tiler = FindObjectOfType <Tile3D>(); } Selection.activeGameObject = tiler.gameObject; Debug.Log("AB"); } else if (toolType == ToolType.Stage) { if (builder == null) { builder = FindObjectOfType <StageBuilder>(); } Selection.activeGameObject = builder.gameObject; Debug.Log("CD"); } } if (toolType == ToolType.Tile3D) { tileTool = (Tile3DTool)GUILayout.Toolbar((int)tileTool, new string[] { "Mesh", "Paint" }, (GUIStyle)"OL Titlemid"); } else if (toolType == ToolType.Stage) { stageTool = (StageTool)GUILayout.Toolbar((int)stageTool, new string[] { "Data", "Gimick", "Respawn", "Right", "Left" }, (GUIStyle)"OL Titlemid"); } }
private static void BuildStage(StageBuilder dungeonBuilder) { var newStage = new Stage(81, 35); newStage.HasExitDown = true; newStage.HasExitUp = true; dungeonBuilder.Generate(newStage); var appearances = newStage.Appearances; var debugger = Coslen.RogueTiler.Domain.Utilities.Debugger.Instance; debugger.addStage(newStage); }
public static void LoadCustomStages() { // Remove existing stages to prevent conflicts _CustomStages.Clear(); // Add a stage for each file in the games resources foreach (string fileName in StageBuilder.GetStageListFromResources()) { Stage stage = StageBuilder.LoadStageFromResources(fileName); stage.StageName = fileName; _CustomStages.Add(stage); } }
public void Get_StageWithMultipleSteps_StepsAreOrderdByAttemptAndThenByRank() { //Arrange var request = new GetReleasesHttpRequestMessageBuilder().Build(); var expectedRelease = new ReleaseBuilder().Build(); var expectedEnvironment = new EnvironmentBuilder().Build(); var expectedStage = new StageBuilder().ForEnvironment(expectedEnvironment).Build(); var expectedStepBuilder = new StepBuilder().ForRelease(expectedRelease).ForStage(expectedStage); var expectedStepWithAttempt1AndRank1 = expectedStepBuilder.WithAttempt(1).WithRank(1).Build(); var expectedStepWithAttempt1AndRank2 = expectedStepBuilder.WithAttempt(1).WithRank(2).Build(); var expectedStepWithAttempt1AndRank3 = expectedStepBuilder.WithAttempt(1).WithRank(3).Build(); var expectedStepWithAttempt2AndRank1 = expectedStepBuilder.WithAttempt(2).WithRank(1).Build(); var expectedStepWithAttempt2AndRank2 = expectedStepBuilder.WithAttempt(2).WithRank(2).Build(); var dataModel = new DataModelBuilder() .WithRelease(expectedRelease) .WithEnvironment(expectedEnvironment) .WithStage(expectedStage) .WithStageWorkflowFor(expectedRelease, expectedStage) //add steps in 'random' order to check sorting of steps by attempt and then by rank .WithStep(expectedStepWithAttempt2AndRank2) .WithStep(expectedStepWithAttempt1AndRank2) .WithStep(expectedStepWithAttempt1AndRank1) .WithStep(expectedStepWithAttempt1AndRank3) .WithStep(expectedStepWithAttempt2AndRank1) .Build(); _releaseRepositoryMock.Setup((stub) => stub.GetReleaseData(It.IsAny <string>(), It.IsAny <int>())) .Returns(dataModel); //Act dynamic result = _sut.Get(request); //Assert Assert.IsNotNull(result, "Unexpected result"); var stage = result.releases[0].stages[0]; Assert.AreEqual(expectedStepWithAttempt1AndRank1.Id, stage.steps[0].id, "Unexpected first step"); Assert.AreEqual(expectedStepWithAttempt1AndRank2.Id, stage.steps[1].id, "Unexpected second step"); Assert.AreEqual(expectedStepWithAttempt1AndRank3.Id, stage.steps[2].id, "Unexpected third step"); Assert.AreEqual(expectedStepWithAttempt2AndRank1.Id, stage.steps[3].id, "Unexpected fourth step"); Assert.AreEqual(expectedStepWithAttempt2AndRank2.Id, stage.steps[4].id, "Unexpected fifth step"); }
public static DiseaseStage Get(DiseaseLevels level, int gameHoursToReach) { return(StageBuilder.NewStage() .WithLevelOfSeriousness(level) .NoSelfHeal() .Vitals .WillReachTargetsInHours(gameHoursToReach) .AndLastForHours(gameHoursToReach) .WithTargetHeartRate(67) .WithTargetBloodPressure(125, 74) .WithTargetBodyTemperature(36.7f) .NoAdditionalEffects() .NoDisorders() .NoDrains() .Treatment .WithoutConsumable() .AndWithoutSpecialItems() .Build()); }
// Use this for initialization void Start () { s_score = 0; s_gameover = false; m_hit = false; m_controller = GetComponent<ThirdPersonCharacter>(); m_animator = GetComponent<Animator>(); m_audio = gameObject.GetComponent<AudioSource>(); m_stage = GameObject.FindGameObjectWithTag(m_StageTag).GetComponent<StageBuilder>(); if (!m_controller) { m_animator.SetFloat("direction", -1.0f); } m_foots = new Transform[m_Foots.Length]; m_footYs = new float[m_Foots.Length]; for (var i = 0; i < m_Foots.Length; i++) { m_foots[i] = searchTransform(transform, m_Foots[i]); m_footYs[i] = m_foots[i].position.y; } m_offset = Vector3.zero; transform.position = m_offset; }
public Hyperthermia() { Name = "Hyperthermia"; Stages = new List <DiseaseStage>(new[] { StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.InitialStage) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(37.5f) .WithTargetHeartRate(76) .WillReachTargetsInHours(1) .AndLastForHours(1) .AdditionalEffects .WithLowAdditionalStaminaDrain() .NoDisorders() .NoDrains() .Treatment .WithoutConsumable() .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Worrying) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(38.3f) .WithTargetHeartRate(85) .WithTargetBloodPressure(132f, 78) .WillReachTargetsInHours(1) .AndLastForHours(1) .AdditionalEffects .WithMediumAdditionalStaminaDrain() .Disorders .NotDeadly() .Drain .FatigueIncreasePerSecond(0.0078f) .Treatment .WithoutConsumable() .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Critical) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(39.9f) .WithTargetHeartRate(108) .WithTargetBloodPressure(152f, 101f) .WillReachTargetsInHours(1) .AndLastUntilEnd() .AdditionalEffects .WithMediumAdditionalStaminaDrain() .Disorders .WillNotBeAbleToRun() .WithFoodDisgust() .NotDeadly() .Drain .FatigueIncreasePerSecond(0.0106f) .Treatment .WithoutConsumable() .AndWithoutSpecialItems() .Build() }); }
public Flu() { // Describe treatment for each stage _initialStageTreatment = new ConsumableTimedTreatment(DiseaseLevels.InitialStage, MedicalConsumablesGroup.OseltamivirGroup); _progressingStageTreatment = new ConsumableTimedTreatment(DiseaseLevels.Progressing, MedicalConsumablesGroup.OseltamivirGroup, 60, 3); _worryingStageTreatment = new ConsumableTimedTreatmentNode(DiseaseLevels.Worrying, new ConsumableTimedTreatment(MedicalConsumablesGroup.OseltamivirGroup, 90, 3), new ConsumableTimedTreatment(MedicalConsumablesGroup.AntibioticGroup, 90, 3) ); _criticalingStageTreatment = new ConsumableTimedTreatmentNode(DiseaseLevels.Critical, new ConsumableTimedTreatment(MedicalConsumablesGroup.OseltamivirGroup, 90, 4), new ConsumableTimedTreatment(MedicalConsumablesGroup.AntibioticGroup, 90, 4) ); Name = "Flu"; Stages = new List <DiseaseStage>(new[] { StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.InitialStage) .SelfHealChance(20) .Vitals .WithTargetBodyTemperature(37.1f) .WillReachTargetsInHours(1) .AndLastForHours(3) .AdditionalEffects .WithLowChanceOfSneeze() .NoDisorders() .NoDrains() .Treatment .WithConsumable(_initialStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Progressing) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(37.9f) .WillReachTargetsInHours(2) .AndLastForHours(2).AndMinutes(35) .AdditionalEffects .WithMediumChanceOfSneeze() .WithLowChanceOfCough() .NoDisorders() .Drain .FatigueIncreasePerSecond(0.0001f) .Treatment .WithConsumable(_progressingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Worrying) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(38.7f) .WillReachTargetsInHours(2) .AndLastForHours(4).AndMinutes(30) .AdditionalEffects .WithHighChanceOfSneeze() .WithMediumChanceOfCough() .WithLowChanceOfDizziness() .NoDisorders() .Drain .WaterPerSecond(0.005f) .FatigueIncreasePerSecond(0.0002f) .Treatment .WithConsumable(_worryingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Critical) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(41.2f) .WillReachTargetsInHours(2) .AndLastUntilEnd() .AdditionalEffects .WithHighChanceOfCough() .WithMediumChanceOfDizziness() .WithLowChanceOfBlackouts() .Disorders .WillNotBeAbleToRun() .NotDeadly() .Drain .WaterPerSecond(0.01f) .FoodPerSecond(0.005f) .FatigueIncreasePerSecond(0.00035f) .Treatment .WithConsumable(_criticalingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build() }); }
public FoodPoisoning() { // Describe treatment for each stage _initialStageTreatment = new ConsumableTimedTreatment(DiseaseLevels.InitialStage, MedicalConsumablesGroup.LoperamideGroup); _progressingStageTreatment = new ConsumableTimedTreatment(DiseaseLevels.Progressing, MedicalConsumablesGroup.LoperamideGroup, 90, 2); _worryingStageTreatment = new ConsumableTimedTreatmentNode(DiseaseLevels.Worrying, new ConsumableTimedTreatment(MedicalConsumablesGroup.LoperamideGroup, 90, 3), new ConsumableTimedTreatment(MedicalConsumablesGroup.AntibioticGroup, 60, 3) ); _criticalingStageTreatment = new ConsumableTimedTreatmentNode(DiseaseLevels.Critical, new ConsumableTimedTreatment(MedicalConsumablesGroup.LoperamideGroup, 90, 4), new ConsumableTimedTreatment(MedicalConsumablesGroup.AntibioticGroup, 60, 4) ); Name = "FoodPoisoning"; Stages = new List <DiseaseStage>(new[] { StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.InitialStage) .SelfHealChance(5) .Vitals .WithTargetBodyTemperature(36.9f) .WillReachTargetsInHours(1) .AndLastForHours(3) .NoAdditionalEffects() .NoDisorders() .NoDrains() .Treatment .WithConsumable(_initialStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Progressing) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(37.2f) .WillReachTargetsInHours(1) .AndLastForHours(1).AndMinutes(35) .NoAdditionalEffects() .NoDisorders() .Drain .FatigueIncreasePerSecond(0.00005f) .Treatment .WithConsumable(_progressingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Worrying) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(37.9f) .WillReachTargetsInHours(2) .AndLastForHours(2).AndMinutes(30) .AdditionalEffects .Disorders .WithFoodDisgust() .NotDeadly() .Drain .WaterPerSecond(0.0025f) .FatigueIncreasePerSecond(0.0001f) .Treatment .WithConsumable(_worryingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Critical) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(38.6f) .WillReachTargetsInHours(2) .AndLastUntilEnd() .NoAdditionalEffects() .Disorders .WithFoodDisgust() .NotDeadly() .Drain .WaterPerSecond(0.01f) .FoodPerSecond(0.005f) .FatigueIncreasePerSecond(0.00035f) .Treatment .WithConsumable(_criticalingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build() }); }
public void TestBuilder() { StageBuilder <TestModule> builder = new StageBuilder <TestModule>(new TestDataLayer(), RunInfo <int> .Empty, StagePath.Root); var modules = builder.Configure((b) => new(b) { Name = "Root" })
public Angina() { // Describe treatment for each stage _initialStageTreatment = new ConsumableTimedTreatment(DiseaseLevels.InitialStage, MedicalConsumablesGroup.AcetaminophenGroup, 90, 2); _progressingStageTreatment = new ConsumableTimedTreatment(DiseaseLevels.Progressing, MedicalConsumablesGroup.AcetaminophenGroup, 60, 3); _worryingStageTreatment = new ConsumableTimedTreatmentNode(DiseaseLevels.Worrying, new ConsumableTimedTreatment(MedicalConsumablesGroup.AcetaminophenGroup, 60, 3), new ConsumableTimedTreatment(MedicalConsumablesGroup.AntibioticGroup, 60, 3) ); _criticalingStageTreatment = new ConsumableTimedTreatmentNode(DiseaseLevels.Critical, new ConsumableTimedTreatment(MedicalConsumablesGroup.AcetaminophenGroup, 60, 4), new ConsumableTimedTreatment(MedicalConsumablesGroup.AntibioticGroup, 60, 4) ); Name = "Angina"; Stages = new List <DiseaseStage> (new [] { StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.InitialStage) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(38.0f) .WillReachTargetsInHours(2) .AndLastForHours(3) .AdditionalEffects .WithLowChanceOfCough() .NoDisorders() .Drain .FatigueIncreasePerSecond(0.0015f) .Treatment .WithConsumable(_initialStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Progressing) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(38.9f) .WillReachTargetsInHours(2) .AndLastForHours(4).AndMinutes(40) .AdditionalEffects .WithMediumChanceOfCough() .NoDisorders() .Drain .FatigueIncreasePerSecond(0.025f) .Treatment .WithConsumable(_progressingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Worrying) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(39.1f) .WithTargetBloodPressure(182, 120) .WithTargetHeartRate(92) .WillReachTargetsInHours(1) .AndLastForHours(4).AndMinutes(30) .AdditionalEffects .WithHighChanceOfCough() .WithLowChanceOfDizziness() .Disorders .WithFoodDisgust() .NotDeadly() .Drain .FoodPerSecond(0.007f) .WaterPerSecond(0.005f) .FatigueIncreasePerSecond(0.0035f) .Treatment .WithConsumable(_worryingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Critical) .NoSelfHeal() .Vitals .WithTargetBodyTemperature(41.1f) .WithTargetBloodPressure(203, 180) .WithTargetHeartRate(130) .WillReachTargetsInHours(2) .AndLastUntilEnd() .AdditionalEffects .WithHighChanceOfCough() .WithHighChanceOfDizziness() .WithMediumChanceOfBlackouts() .Disorders .WithFoodDisgust() .WithSleepDisorder() .WillNotBeAbleToRun() .NotDeadly() .Drain .FoodPerSecond(0.05f) .WaterPerSecond(0.015f) .FatigueIncreasePerSecond(0.0042f) .Treatment .WithConsumable(_criticalingStageTreatment.OnItemConsumed) .AndWithoutSpecialItems() .Build() }); }
public void Get_ReleaseWithStageAndStepFound_ReleaseWithStageAndStepReturned() { //Arrange var request = new GetReleasesHttpRequestMessageBuilder().Build(); var expectedRelease = new ReleaseBuilder().Build(); var expectedEnvironment = new EnvironmentBuilder().Build(); var expectedStage = new StageBuilder().ForEnvironment(expectedEnvironment).Build(); var expectedStep = new StepBuilder() .ForRelease(expectedRelease) .ForStage(expectedStage) .Build(); var expectedDeploymentStep = new DeploymentStepBuilder() .ForRelease(expectedRelease) .ForStage(expectedStage) .ForStep(expectedStep) .Build(); var dataModel = new DataModelBuilder() .WithRelease(expectedRelease) .WithEnvironment(expectedEnvironment) .WithStage(expectedStage) .WithStageWorkflowFor(expectedRelease, expectedStage) .WithStep(expectedStep) .WithDeploymentStep(expectedDeploymentStep) .Build(); _releaseRepositoryMock.Setup((stub) => stub.GetReleaseData(It.IsAny<string>(), It.IsAny<int>())) .Returns(dataModel); //Act dynamic result = _sut.Get(request); //Assert Assert.IsNotNull(result, "Unexpected result"); Assert.IsInstanceOfType(result.releases, typeof(List<dynamic>), "Unexpected type for releases collection"); Assert.AreEqual(1, result.releases.Count, "Unexpected number of releases"); var actualRelease = result.releases[0]; AssertAreReleasesEqual(expectedRelease, actualRelease); Assert.IsInstanceOfType(actualRelease.stages, typeof(List<dynamic>), "Unexpected type for stages collection"); Assert.AreEqual(1, actualRelease.stages.Count, "Unexpected number of stages for release"); var actualStage = actualRelease.stages[0]; AssertAreStagesEqual(expectedStage, expectedEnvironment, actualStage); Assert.IsInstanceOfType(actualStage.steps, typeof(List<dynamic>), "Unexpected type for steps collection"); Assert.AreEqual(1, actualStage.steps.Count, "Unexpected number of steps for stage"); var actualStep = actualStage.steps[0]; AssertAreStepsEqual(expectedStep, actualStep); Assert.IsInstanceOfType(actualStep.deploymentSteps, typeof(List<dynamic>), "Unexpected type for deploymentStep collection"); Assert.AreEqual(1, actualStep.deploymentSteps.Count, "Unexpected number of steps for deploymentSteps"); AssertAreDeploymentStepsEqual(expectedDeploymentStep, actualStep.deploymentSteps[0]); }
public EmptyStageBuilderTests() { _builder = new StageBuilder(); }
public PopulatedStageBuilderTests() { _stageOne = new StageOne(); _stageTwo = new StageTwo(); _builder = new StageBuilder(new[] { _stageOne, _stageTwo, }); }
public void Get_StageWithMultipleSteps_StepsAreOrderdByAttemptAndThenByRank() { //Arrange var request = new GetReleasesHttpRequestMessageBuilder().Build(); var expectedRelease = new ReleaseBuilder().Build(); var expectedEnvironment = new EnvironmentBuilder().Build(); var expectedStage = new StageBuilder().ForEnvironment(expectedEnvironment).Build(); var expectedStepBuilder = new StepBuilder().ForRelease(expectedRelease).ForStage(expectedStage); var expectedStepWithAttempt1AndRank1 = expectedStepBuilder.WithAttempt(1).WithRank(1).Build(); var expectedStepWithAttempt1AndRank2 = expectedStepBuilder.WithAttempt(1).WithRank(2).Build(); var expectedStepWithAttempt1AndRank3 = expectedStepBuilder.WithAttempt(1).WithRank(3).Build(); var expectedStepWithAttempt2AndRank1 = expectedStepBuilder.WithAttempt(2).WithRank(1).Build(); var expectedStepWithAttempt2AndRank2 = expectedStepBuilder.WithAttempt(2).WithRank(2).Build(); var dataModel = new DataModelBuilder() .WithRelease(expectedRelease) .WithEnvironment(expectedEnvironment) .WithStage(expectedStage) .WithStageWorkflowFor(expectedRelease, expectedStage) //add steps in 'random' order to check sorting of steps by attempt and then by rank .WithStep(expectedStepWithAttempt2AndRank2) .WithStep(expectedStepWithAttempt1AndRank2) .WithStep(expectedStepWithAttempt1AndRank1) .WithStep(expectedStepWithAttempt1AndRank3) .WithStep(expectedStepWithAttempt2AndRank1) .Build(); _releaseRepositoryMock.Setup((stub) => stub.GetReleaseData(It.IsAny<string>(), It.IsAny<int>())) .Returns(dataModel); //Act dynamic result = _sut.Get(request); //Assert Assert.IsNotNull(result, "Unexpected result"); var stage = result.releases[0].stages[0]; Assert.AreEqual(expectedStepWithAttempt1AndRank1.Id, stage.steps[0].id, "Unexpected first step"); Assert.AreEqual(expectedStepWithAttempt1AndRank2.Id, stage.steps[1].id, "Unexpected second step"); Assert.AreEqual(expectedStepWithAttempt1AndRank3.Id, stage.steps[2].id, "Unexpected third step"); Assert.AreEqual(expectedStepWithAttempt2AndRank1.Id, stage.steps[3].id, "Unexpected fourth step"); Assert.AreEqual(expectedStepWithAttempt2AndRank2.Id, stage.steps[4].id, "Unexpected fifth step"); }
public override void InitializeWithInjury(BodyParts initialInjury) { BodyPart = initialInjury; // Describe treatment for each stage _progressingStageTreatment = new ApplianceTimedTreatmentNode(DiseaseLevels.Progressing, new ApplianceTimedTreatment(initialInjury, InventoryController.MedicalItems.SuctionPump), new ApplianceTimedTreatment(null, InventoryController.MedicalItems.AntiVenomSyringe) ); _worryingStageTreatment = new ApplianceTimedTreatmentNode(DiseaseLevels.Worrying, new ApplianceTimedTreatment(initialInjury, InventoryController.MedicalItems.SuctionPump), new ApplianceTimedTreatment(null, InventoryController.MedicalItems.AntiVenomSyringe, 60, 2) ); _criticalingStageTreatment = new ApplianceTimedTreatmentNode(DiseaseLevels.Critical, new ApplianceTimedTreatment(initialInjury, InventoryController.MedicalItems.SuctionPump), new ApplianceTimedTreatment(null, InventoryController.MedicalItems.AntiVenomSyringe, 60, 3) ); Stages = new List <DiseaseStage>(new[] { StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Progressing) .NoSelfHeal() .Vitals .WithTargetHeartRate(95) .WithTargetBloodPressure(154, 83) .WithTargetBodyTemperature(39.6f) .WillReachTargetsInHours(1) .AndLastForHours(3) .AdditionalEffects .WithLowChanceOfBlackouts() .WithLowAdditionalStaminaDrain() .Disorders .NotDeadly() .Drain .FatigueIncreasePerSecond(0.0004f) .Treatment .WithAppliance(_progressingStageTreatment.OnApplianceTaken) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Worrying) .NoSelfHeal() .Vitals .WithTargetHeartRate(126) .WithTargetBloodPressure(196, 98) .WithTargetBodyTemperature(40.1f) .WillReachTargetsInHours(2) .AndLastForHours(3).AndMinutes(10) .AdditionalEffects .WithMediumChanceOfBlackouts() .WithMediumAdditionalStaminaDrain() .NoDisorders() .Drain .WaterPerSecond(0.01f) .FatigueIncreasePerSecond(0.0006f) .Treatment .WithAppliance(_worryingStageTreatment.OnApplianceTaken) .AndWithoutSpecialItems() .Build(), StageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.Critical) .NoSelfHeal() .Vitals .WithTargetHeartRate(148) .WithTargetBloodPressure(204, 112) .WithTargetBodyTemperature(41.6f) .WillReachTargetsInHours(2) .AndLastUntilEnd() .AdditionalEffects .WithMediumChanceOfDizziness() .WithLowChanceOfBlackouts() .WithHighAdditionalStaminaDrain() .Disorders .WillNotBeAbleToRun() .NotDeadly() .Drain .WaterPerSecond(0.015f) .FoodPerSecond(0.008f) .FatigueIncreasePerSecond(0.00085f) .Treatment .WithAppliance(_criticalingStageTreatment.OnApplianceTaken) .AndWithoutSpecialItems() .Build() }); }