示例#1
0
        public static Entity CreateEntity(EntityManager entity_manager,
                                          UnityEngine.Vector3 localPos,
                                          UnityEngine.Quaternion localRot,
                                          ref AtomicFloat life,
                                          Entity parent_entity,
                                          ref RandomLocal random)
        {
            var entity = entity_manager.CreateEntity(archetype_);

            entity_manager.SetComponentData(entity, LockTarget.Create(ref life));
            entity_manager.SetComponentData(entity, new Position {
                Value = localPos,
            });
            entity_manager.SetComponentData(entity, new Rotation {
                Value = localRot,
            });
            entity_manager.SetComponentData(entity, random.create());

            var attach_entity = entity_manager.CreateEntity(typeof(Attach));

            entity_manager.SetComponentData(attach_entity, new Attach {
                Parent = parent_entity, Child = entity,
            });

            return(entity);
        }