/// <summary> /// Regenerates the things related to the given creation step /// </summary> /// <param name="step">The creation step that contains the things that are wanted to be regenerated</param> public void Regenerate(CreationStep step, bool generateNextStepOnFinish = false) { // Debug.Log($"Regenerating '{step.ToString()}'"); switch (step) { case CreationStep.Light: Debug.LogWarning("Light Regeneration: NotImplementedException();"); break; case CreationStep.Terrain: terrainGenerator.Generate(true, generateNextStepOnFinish); RegenerateTerrainTextures(); break; case CreationStep.WaterSources: waterSourcesGenerator.Generate(true, generateNextStepOnFinish); break; case CreationStep.Vegetation: vegetationGenerator.Generate(true, generateNextStepOnFinish); break; case CreationStep.Night: Debug.LogWarning("Night Regeneration: NotImplementedException();"); break; case CreationStep.FishAndBirds: Debug.LogWarning("FishAndBirds Regeneration: NotImplementedException();"); break; case CreationStep.LandAnimals: Debug.LogWarning("LandAnimals Regeneration: NotImplementedException();"); break; case CreationStep.Humanoids: humanoidsGenerator.Generate(true, generateNextStepOnFinish); break; default: throw new ArgumentOutOfRangeException(nameof(step), step, $"Trying to generate creation step with no generation process: {Enum.GetName(typeof(CreationStep), step)}"); } }
public CharacterCreation() { this.player = new Player(); keyInfo = new ConsoleKeyInfo(); creationStep = CreationStep.Name; classItemList = new Dictionary<string, MenuItem>(); classItems = new string[] { "F", "R", "W" }; classItemList.Add(classItems[classIndex], new MenuItem(classItems[classIndex++], "#A0F|ighter")); classItemList.Add(classItems[classIndex], new MenuItem(classItems[classIndex++], "#B0R|ogue")); classItemList.Add(classItems[classIndex], new MenuItem(classItems[classIndex++], "#C0W|izard")); ClassIndex = 0; selectedItem = classItemList[classItems[ClassIndex]]; rand = new Random(); strength = rand.Next(8, 21); dexterity = rand.Next(8, 21); constitution = rand.Next(8, 21); intelligence = rand.Next(8, 21); wisdom = rand.Next(8, 21); charisma = rand.Next(8, 21); }
/// <summary> /// Generates the contents of a creation step /// </summary> public void RegenerateCreationStep(CreationStep creationStep) { mapGenerator.Regenerate(creationStep); }
public override StateMachine.StateAction During(GameTime gameTime) { switch (creationStep) { case CreationStep.Name: string name = ""; while (String.IsNullOrEmpty(name)) { name = Console.ReadLine(); if (String.IsNullOrEmpty(name)) continue; player.Name = name; creationStep = CreationStep.Class; } break; case CreationStep.Class: while (player.Class == Player.PlayerClass.None) { keyInfo = Console.ReadKey(true); if (keyInfo.Key == ConsoleKey.Spacebar) return StateMachine.StateAction.Continue; if (classItemList.ContainsKey(keyInfo.Key.ToString().ToUpper())) while (!classItems[ClassIndex].Equals(keyInfo.Key.ToString())) ClassIndex++; if (keyInfo.Key == ConsoleKey.UpArrow || keyInfo.Key == ConsoleKey.LeftArrow) ClassIndex--; if (keyInfo.Key == ConsoleKey.DownArrow || keyInfo.Key == ConsoleKey.RightArrow) ClassIndex++; selectedItem = classItemList[classItems[ClassIndex]]; if (keyInfo.Key == ConsoleKey.Enter) { selectedItem = classItemList[classItems[ClassIndex]]; player.Class = (Player.PlayerClass)(ClassIndex + 1); creationStep = CreationStep.Stats; //return StateMachine.StateAction.Continue; } return StateMachine.StateAction.Remain; } break; case CreationStep.Stats: while (player.Strength == 0) { keyInfo = Console.ReadKey(true); if (keyInfo.Key == ConsoleKey.Spacebar) return StateMachine.StateAction.Continue; if (keyInfo.Key == ConsoleKey.R) { strength = rand.Next(8, 21); dexterity = rand.Next(8, 21); constitution = rand.Next(8, 21); intelligence = rand.Next(8, 21); wisdom = rand.Next(8, 21); charisma = rand.Next(8, 21); } if (keyInfo.Key == ConsoleKey.Enter) { player.Strength = strength; player.Dexterity = dexterity; player.Constitution = constitution; player.Intelligence = intelligence; player.Wisdom = wisdom; player.Charisma = charisma; return StateMachine.StateAction.Continue; } if (keyInfo.Key == ConsoleKey.Enter) { //return StateMachine.StateAction.Continue; } return StateMachine.StateAction.Remain; } break; default: throw new ArgumentOutOfRangeException(); } if (keyInfo.Key == ConsoleKey.X) return StateMachine.StateAction.Continue; return StateMachine.StateAction.Remain; }