Scripting API

Scripting API

ControllerFiles

Class in Abyss.Core, from Abyss.Core.

An animator controller as a file of its own: a .controller in a game's assets, which says what an animator plays and when, as layers of states in order.

public static class ControllerFiles

Remarks

Named by an animator, by its file's identity, in the Animator's Controller slot. While a game plays, the first of a layer's states whose condition holds plays, faded into from what played before; a condition reads a game's own fields, Movement.Speed > 0.1, on the animator's entity or the nearest of its parents with the component. A clip played from code plays over the list until it is done. A state plays a clip, or a blend space: its points' clips mixed by where one field, or two, falls among the places they are given, and kept in step. It is JSON:

{  "abyssController": 3,  "layers": [    {      "name": "Base",      "fade": 0.25,      "curve": "smooth",      "fades": [ { "from": "Jump", "to": "Fall", "seconds": 0.1 } ],      "states": [        { "name": "Fall", "when": "!Movement.Grounded && Movement.VerticalSpeed < -2", "clip": "models/hero.glb#Fall", "model": "6d33cf113bfc4cd183855291b38be3c0" },        { "name": "Jump", "when": "!Movement.Grounded", "clip": "models/hero.glb#Jump", "leaves": "end" },        { "name": "Move", "when": "Movement.Speed > 0.1", "blend": { "along": "Movement.Speed", "points": [ { "clip": "models/hero.glb#Walk", "at": 1.5 }, { "clip": "models/hero.glb#Run", "at": 5 } ] } },        { "name": "Idle", "clip": "models/hero.glb#Idle", "leaves": { "after": 0.3 } }      ]    }  ]}

A clip names its model by its path and, under model, by its identity, so a model moved or renamed is still found; a clip file, sprites/coin.anim, is named the same way (see AnimationClipFiles). Layers stack, the first at the bottom, each above it laid over what is under it as much as its weight: in place of it on the bones its mask names, or its clips' movement away from their own first frames added on top, "blending": "additive".

Properties

New

public static string New { get; }

What a new controller file says: one layer, Base, with no states.

Methods

Is

public static bool Is(string path)

Whether a path names a controller file, by its extension.

Parameters

  • path

Constants

Extension

public const string Extension = ".controller"

The extension a controller file has.

Version

public const int Version = 3

The version of a controller file this build writes; it reads this and every one before it.

Version 1 had no blend spaces, and version 2 no layer's weight, blending or mask.

Key

public const string Key = "abyssController"

The key that says a file is a controller file, and which version.