Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.
/ Gentitas Public archive

Gentitas is a fast code generator for Entitas projects in Unity3D

License

Notifications You must be signed in to change notification settings

vladpazych/Gentitas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.



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