Example #1
0
        public static ent Create(string prefabID, Vector3 position, bool pooled = false)
        {
            int  id;
            byte age = 0;

            if (ent.entityStackLength > 0)
            {
                var  pop    = ent.entityStack.Dequeue();
                byte ageOld = pop.age;
                id = pop.id;
                unchecked
                {
                    age = (byte)(ageOld + 1);
                }

                ent.entityStackLength--;
            }
            else
            {
                id = ent.lastID++;
            }

            Initialize(id, age, pooled);
            transforms[id] = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefabID, position) : HelperFramework.SpawnInternal(prefabID, position);
            return(new ent(id, age));
        }
Example #2
0
        public static ent Create(GameObject prefab, ModelComposer model, bool pooled = false)
        {
            int  id;
            byte age = 0;

            if (ent.entityStackLength > 0)
            {
                var  pop    = ent.entityStack.Dequeue();
                byte ageOld = pop.age;
                id = pop.id;
                unchecked
                {
                    age = (byte)(ageOld + 1);
                }

                ent.entityStackLength--;
            }
            else
            {
                id = ent.lastID++;
            }

            var entity = new ent(id, age);

            Initialize(id, age, pooled);
            transforms[id] = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefab) : HelperFramework.SpawnInternal(prefab);
            model(entity, null);
            Delayed.Set(entity, 0, Delayed.Action.Activate);

            return(entity);
        }
Example #3
0
        public static ent Create(GameObject prefab, BlueprintEntity bpAsset, bool pooled = false)
        {
            int  id;
            byte age = 0;

            if (ent.entityStackLength > 0)
            {
                var  pop    = ent.entityStack.Dequeue();
                byte ageOld = pop.age;
                id = pop.id;
                unchecked
                {
                    age = (byte)(ageOld + 1);
                }

                ent.entityStackLength--;
            }
            else
            {
                id = ent.lastID++;
            }

            var entity = new ent(id, age);

            Initialize(id, age, pooled);
            transforms[id] = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefab) : HelperFramework.SpawnInternal(prefab);
            bpAsset.Execute(entity);
            return(entity);
        }
Example #4
0
        public static Actor Create(GameObject prefab, bool pooled = false)
        {
            var tr    = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefab) : HelperFramework.SpawnInternal(prefab);
            var actor = tr.AddGetActor();

            actor.isPooled = pooled;
            actor.Launch();
            return(actor);
        }
Example #5
0
        public static Actor Create(GameObject prefab, ModelComposer model, Vector3 position, bool pooled = false)
        {
            var tr    = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefab, position) : HelperFramework.SpawnInternal(prefab, position);
            var actor = tr.AddGetActor();

            actor.isPooled = pooled;
            actor.Launch(model);
            return(actor);
        }
Example #6
0
        public static Actor Create(string prefabID, ModelComposer model, bool pooled = false)
        {
            var tr    = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefabID) : HelperFramework.SpawnInternal(prefabID);
            var actor = tr.AddGetActor();

            actor.isPooled = pooled;
            actor.Launch(model);
            return(actor);
        }
Example #7
0
        public static Actor Create(string prefabID, BlueprintEntity bp, bool pooled = false)
        {
            var tr    = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefabID) : HelperFramework.SpawnInternal(prefabID);
            var actor = tr.AddGetActor();

            actor.buildFrom = bp;
            actor.isPooled  = pooled;
            actor.Launch();
            return(actor);
        }
Example #8
0
        public static Actor Create(string prefabID, Vector3 position, bool pooled = false)
        {
            var tr    = pooled ? HelperFramework.SpawnInternal(Pool.Entities, prefabID, position) : HelperFramework.SpawnInternal(prefabID, position);
            var actor = tr.AddGetActor();

            actor.isPooled = pooled;
            actor.Launch();

            return(actor);
        }