Example #1
0
    public void InitWithKey(CharacterKey key)
    {
        Key = key;

        StoryFeed[] _storyFeeds = FindObjectsOfType <StoryFeed>();

        foreach (StoryFeed storyFeed in _storyFeeds)
        {
            if (storyFeed.CharacterKey == key)
            {
                _storyFeed = storyFeed;
                break;
            }
        }

        TextAsset inkStoryJson = Resources.Load <TextAsset>(ResourcePaths.StoryEngineInkJsonPath);

        _inkStory = Story.CreateWithJson(inkStoryJson.text);

        StoryScene debugSceneToPlay = StoryManager.Instance.GetScene(DebugSettings.Instance.LoadIntoScene);

        if (debugSceneToPlay == null && string.IsNullOrEmpty(DebugSettings.Instance.LoadIntoScene) == false)
        {
            int i;
            if (int.TryParse(DebugSettings.Instance.LoadIntoScene, out i))
            {
                debugSceneToPlay = StoryManager.Instance.GetScene(Key, i);
                _nextSceneIndex  = i + 1;
            }
        }

        if (debugSceneToPlay != null)
        {
            StartScene(debugSceneToPlay);
        }
        else
        {
            // todo - load the first scene!
            StartScene(StoryManager.Instance.GetScene("intro"));
        }
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     _inkStory  = new Story(StoryAsset.text);
     _storyFeed = GetComponent <StoryFeed>();
     StartCoroutine(ProcessStory());
 }