Skip to content

Creating your first cutscene and tokens!

DDevilISL edited this page Jan 19, 2018 · 1 revision

The first step, creating a cutscene.

A Cutscene is merely a ScriptableObject, so you can create one by right clicking and going to "Create/Shiroi/Cutscenes/Cutscene"

Creating your own tokens!

ShiroiCutscenes will automatically check your assemblies for any types that implements IToken and will add them to the "known tokens" list, just like Unity does with your scripts, the difference is that Shiroi doesn't have any rules about how and where these types must be declared, so if you want you can define more than one token in a single file.
The only restriction is that your token MUST have a no args constructor.
So let's go ahead and create something!

public class MyToken : IToken {
    public IEnumerator Execute(CutscenePlayer player) {
        yield break;
    }
}

If we go back to unity, and check our cutscene, we'll see that Shiroi has found our token and added it on the "Choose your flavour" menu.

And when we add it to our cutscene.

I swear it's not magic.
However, we don't have too much info to work with right now, let's say we want to spawn a ParticleSystem somewhere in the world, so we'll add some properties to our token!

public class MyToken : IToken {
    public ParticleSystem Prefab;
    public Vector3 Position;

    public IEnumerator Execute(CutscenePlayer player) {
        Object.Instantiate(Prefab, Position, Quaternion.identity);
        yield break;
    }
}

And if we go back to unity once again, we'll find that the inspector now has created fields for us to assign our variables!