vladpazych / Gentitas

Gentitas is a fast code generator for Entitas projects in Unity3D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gentitas - Code Generator for Entitas

Gentitas is a fast code generator for Entitas and a framework on top of Entitas. It watches your Assets folder for Context declarations in .gentitas.cs files and generates Entitas API from them.


Important! This project is dead and no longer maintained, I recommend using official Entitas Code Generator.


» Download

» How to use

» Ask a question / Report a bug

» Wiki and examples

» Go to Entitas repository


First glimpse

// Declaration
namespace Game.YourModule.Declaration
{
    public class State : Context
    {
        State()
        {
            var Application = Component().GroupSingle;
            var RabbitName = Component<string>().Index;
            var Rabbit = Component();
            var RabbitUnit = Component<float>().GroupSingle;
            var Fast = Component();
            var Speed = Component<float>().Group;

            var RabbitWithName = Group(Matcher.All(Rabbit, RabbitName));
            var FastRabbitName = Index(RabbitName, Rabbit, Fast);
        }
    }
}

// If generator is running, it will automatically
// regenerate API so you can use it immediately.

// Usage
void Example ()
{
    // Components
    var entity = Contexts.state.CreateEntity();
    entity.rabbitName = "Steve";
    entity.rabbit = true;
    entity.fast = true;
    entity.speed = 10f;

    // Groups
    var applicationEntity = Contexts.state.applicationEntity;
    var applicationExists = Contexts.state.HasApplication();
    var speedGroup = Contexts.state.speedGroup;
    var speedEntities = Contexts.state.speedEntities;
    var rabbitUnit = Contexts.state.rabbitUnit;
    var rabbitWithNameGroup = Contexts.state.rabbitWithNameGroup;

    // Index
    var numberOfRabbitsWithNameSteve = Contexts.state.fastRabbitNameIndex.GetCount("Steve");
    var rabbitsWithNameSteve = Contexts.state.fastRabbitNameIndex.Find("Steve");
    var rabbitWithNameSteve = Contexts.state.fastRabbitNameIndex.FindSingle("Steve");
}

How to use

  • Download latest version
  • Move downloaded Gentitas folder into your Assets/Plugins* folder
  • Run Tools/Entitas/Check System For Gentitas
  • If you don't have Node.js installed - it will tell you
  • Run Tools/Entitas/Install Gentitas Dependecies
  • Run Tools/Entitas/Start Gentitas Generator
  • Create [AnyFileName].gentitas.cs somewhere in your Assets folder
  • Add declaration code from First glimpse and save file
  • Check your Assets/Generated folder
  • Enjoy generated Entitas API

*It's important to use Plugins folder, otherewise Menu Items will not work.

Download Gentitas

Each release contains framework code, generator code and .sh / .cmd scripts to run generator and install it's dependencies.

Show releases

Contribute

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

Feel free to suggest your ideas.

Maintainer

About

Gentitas is a fast code generator for Entitas projects in Unity3D

License:MIT License


Languages

Language:JavaScript 42.1%Language:HTML 33.9%Language:C# 21.2%Language:Shell 1.6%Language:Batchfile 1.2%