void Update() { //Debug.Log(typing_controller.HasSpawnEntry()); if (typing_controller.HasSpawnEntry()) { StoryEntry spawn_entry = typing_controller.GetSpawnEntry(); Debug.Log(spawn_entry); level_spawner.AddStoryEntry(spawn_entry); } if (current_game_condition == GameCondition.lose_logic) { LoseLogic(); current_game_condition = GameCondition.lose_done; } if (current_game_condition == GameCondition.running) { if (archer.CurrentBowstringCount <= 0) { current_game_condition = GameCondition.lose_logic; } } }
public StoryEntry GetSpawnEntry() { if (!HasSpawnEntry()) { throw new ArgumentException("No spawn entry!"); } var return_object = spawn_entry; spawn_entry = null; return(return_object); }
private void Update() { if (typo_event_controller.GetTypoLockActive) { return; } if (ShootAction()) { archer.ShootArrow(); if (story_controller.IsNextNewStoryEntry()) { Debug.Log("Next is new story entry!"); spawn_entry = story_controller.GetSpawnEntry(); } if (story_controller.HasNextLine()) { current_target_text = story_controller.GetNextLine(); current_typed_text = ""; } } else if (EraseAction()) { current_typed_text = EraseSingleLetterFromText(current_typed_text); } else { string new_typed_text = GetTypedText(); AssignNewTypedText(new_typed_text); if (!IsEnteredTextCorrect()) { PunishTypo(); } } SyncVisualText(); }
private List <StoryEntry> ParseLines(string[] input_lines) { List <StoryEntry> new_story_entries = new List <StoryEntry>(); bool entry_assigned = false; StoryEntry current_entry = new StoryEntry(); foreach (string line in input_lines) { if (line.StartsWith("---")) { if (entry_assigned) { new_story_entries.Add(current_entry); } else { entry_assigned = true; } current_entry = new StoryEntry(); } else if (line.StartsWith("#")) { var field_vals = line.Split(new string[] { ":" }, StringSplitOptions.None); string field_key = field_vals[0]; string field_val = field_vals[1]; AssignFieldEntry(current_entry, field_key, field_val); } else { current_entry.AddStoryLine(line); } } return(new_story_entries); }
private void AssignFieldEntry(StoryEntry entry, string field_key, string field_val) { // Assign stat received from field to appropriate entry method switch (field_key) { case "# Title": entry.SetTitle(field_val); break; case "# Enemies": entry.SetEnemies(int.Parse(field_val)); break; case "# Speed": entry.SetSpeed(int.Parse(field_val)); break; default: Debug.LogWarning("Unvalid story format: " + field_key); break; } }
public void AddStoryEntry(StoryEntry story_entry) { int enemy_count = story_entry.GetEnemyCount(); GenerateNewSpawnPoints(enemy_count); }
private void Start() { current_typed_text = ""; current_target_text = story_controller.GetNextLine(); spawn_entry = story_controller.GetCurrentEntry(); }