public void StartStory(string battleScriptName) { var storyFile = StoryImporter.ReadStory(battleScriptName); var story = new GameFrameStory(storyFile); story.Continue(); DialogBox.StartStory(story); _activeStory = story; }
public void Interact(Point interactTarget) { var validInteraction = FourWayPossibleMovement.FourWayAdjacentLocations(PlayerEntity.Instance.Position.ToPoint()).Contains(interactTarget); if (validInteraction) { PlayerEntity.Instance.FacingDirection = interactTarget.ToVector2() - PlayerEntity.Instance.Position; var interactWith = _expiringSpatialHash.ValueAt(interactTarget); if (interactWith != null) { var story = interactWith.Interact(); story.Continue(); var entityDialogBox = DialogBox as EntityStoryBoxDialog; entityDialogBox?.StartStory(story, interactWith); } else if (Flags.AcquireRod) { if (WaterCollision(interactTarget)) { var random = new Random(); var fishComplete = random.Next(3) == 0; var scriptName = fishComplete ? "fish_success.ink" : "fish_fail.ink"; var fishScript = StoryImporter.ReadStory(scriptName); var story = new GameFrameStory(fishScript); if (fishComplete) { Flags.FishCount++; story.ChoosePathString("dialog"); story.SetVariableState("fish_count", Flags.FishCount); } story.Continue(); DialogBox.StartStory(story); } } } }
public override GameFrameStory Interact() { GameStory = ReadStory(ScriptName); GameStory.ChoosePathString("dialog"); CompleteEvent completeEvent = win => { if (win) { var collision = _collision.Invoke(Position.ToPoint(), EndPosition.ToPoint()); var endPoint = collision ? _alternativeEndPoint : EndPosition; MoveDelegate?.Invoke(this, endPoint.ToPoint()); GameFlags.SetVariable(FlagName, true); AlreadyMoved = true; } var dialog = win ? "victory.ink" : "defeat.ink"; var storyScript = StoryImporter.ReadStory(dialog); var newStory = new GameFrameStory(storyScript); newStory.Continue(); _say.Invoke(newStory); }; ReadStory(GameStory, completeEvent); return(GameStory); }