Skip to content

asyncwise/UnityScriptAccessories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnityScriptAccessories

AnimatorBehaviour

StateMachineBehaviour is a component for state machine. Basically, one script per one state and each script has several functions. One single script for all state is possible but complicated. The more condition, the more painful it is to maintain.

Coroutine is versatile feature to implement state machine. AnimatorBehaviour makes each coroutine synchronous to the state of Animator.

PlayControl game object has Animator and PlayControl script.

Animator controller has triggers for transition between states. Exit Time of a state is optional. Motion is not necessary.

AninamtorBehaviour has a map of state to coroutine which has AnimatorState attribute. Every state event is included in one single coroutine. PlayControl script is like below:

public class PlayControl : AnimatorBehaviour
{
    //...
    
    [AnimatorState("Base Layer.Intro")]
    IEnumerator Intro(int layer, int nameHash)
    {
        //OnStateEnter


        while (StateCondition)
        {
            //OnStateUpdate
            yield return null;
        }
        
        //OnStateExit
    }

    [AnimatorState("Base Layer.PrePlaying")]
    IEnumerator Intro(int layer, int nameHash)
    {
        //...
    }

    //...
}

ExcelImporter

ExcelImporter import excel data directly using NPOI. There are two way to import.
First way is importing as a ScriptableObject.

Second way is importing each data row into each prefab, in order to update many prefabs of same type by batch.

BitmapFontImporter

Tools to generate a bitmap font:

BitmapFontImporter import a bitmap with XML format font data as a fontsettings asset embedded font material and texture.

MessageSpellingChecker

MessageSpellingChecker check spelling of message of MonoBehaviour whenever the scripts are imported and reloaded.

Spline

Spline folder contains SplineEditor, SplineData, SplineFollower.

Linear curve is B(t) = (1 - t) P0 + t P1. The quadratic curve is B(t) = (1 - t) ((1 - t) P0 + t P1) + t ((1 - t) P1 + t P2). It's B(t) = (1 - t)^2 P0 + 2 (1 - t) t P1 + t^2 P2 compactly. And for the direction, the first derivative is B'(t) = 2 (1 - t) (P1 - P0) + 2 t (P2 - P1).

Spline has been implemented as cubic curve. Each point has incomming handle and outgoing handle.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages