public static void Release(this int entity) { var composer = new EntityComposer(entity, 1); composer.Add <ComponentRelease>(); composer.Deploy(); }
// usually you dont need Update method. void Update() { if (Input.GetKeyDown(KeyCode.Q)) { // create new player var composer = new EntityComposer(2); var cPlayer = composer.Add <ComponentPlayer>(); var cObject = composer.Add <ComponentObject>(); cPlayer.name = playerNames.Random(); cObject.transform = this.Populate("Obj Player", Vector3.zero, Quaternion.identity); cObject.transform.AddGet <MonoEntity>().entity = composer.entity; composer.Deploy(); } if (Input.GetKeyDown(KeyCode.W)) { // groups can be global static! var players = ProcessingPlayer.group_players; foreach (var entity in players) { // add new component to selected player entity var composer = new EntityComposer(entity, 1); var cWeapon = composer.Add <ComponentWeapon>(); cWeapon.name = weaponNames.Random(); composer.Deploy(); } } }
public ProcessingSimpleSM() { // fill stateMap with methods stateMap.Add(Tag.StateIdle, HandleStateIdle); stateMap.Add(Tag.StateMove, HandleStateMove); stateMap.Add(Tag.StateAttack, HandleStateAttack); // create turret var composer = new EntityComposer(1); composer.Add <ComponentTurret>(); composer.Deploy(); }