public void Create()
        {
            EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

            EntityArchetype archetype = entityManager.CreateArchetype(
                typeof(Name),
                typeof(CivColors),
                typeof(CivCities),
                typeof(CivUnits)
                );

            Entity entity = entityManager.CreateEntity(archetype);
        }
Пример #2
0
        private void Awake()
        {
            em = World.DefaultGameObjectInjectionWorld.EntityManager;

            EntityArchetype unitArch = em.CreateArchetype(
                typeof(SpComponent),
                typeof(BuffComponent),
                typeof(SkillComponent),
                typeof(StatusComponent),
                typeof(CoordComponent)
                );

            em.CreateEntity(unitArch);
        }
Пример #3
0
        protected override void OnStartRunning()
        {
            base.OnStartRunning();
            setup = EnemySpawner.Instance;

            mainRandom = new Random((uint)System.DateTime.Now.Millisecond);

            enemyPrefab = EntityManager.CreateArchetype(
                typeof(EnemyTag),
                typeof(Translation),
                typeof(Rotation),
                typeof(LocalToWorld)
                );
        }
Пример #4
0
        private static void CreateCommand(HexCoordinates coordinates, bool select)
        {
            EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

            EntityArchetype archetype = entityManager.CreateArchetype(
                typeof(CommandSelectCell)
                );

            Entity entity = entityManager.CreateEntity(archetype);

            entityManager.AddComponentData <CommandSelectCell>(entity, new CommandSelectCell {
                select = select
            });
            entityManager.AddComponentData <HexCoordinates>(entity, coordinates);
        }
Пример #5
0
        protected override void OnStartRunning()
        {
            base.OnStartRunning();
            setup = EnemySpawner.Instance;

            enemyTypePrefab = EntityManager.CreateArchetype(
                typeof(Translation),
                typeof(Rotation),
                typeof(LocalToWorld),
                typeof(LocalToParent),
                typeof(Parent)
                );

            mainRandom     = new Random(1);
            EnemyEnumCount = (int)Enum.GetValues(typeof(EnemyEnum)).Cast <EnemyEnum>().Max() + 1;
        }
        public static void Create(Entity entity)
        {
            EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

            EntityArchetype archetype = entityManager.CreateArchetype(
                typeof(CommandSelectUnit),
                typeof(HexCoordinates)
                );

            Entity selectEntity = entityManager.CreateEntity(archetype);

            HexCoordinates coordinates = entityManager.GetComponentData <HexCoordinates>(entity);

            entityManager.AddComponentData <CommandSelectUnit>(
                selectEntity,
                new CommandSelectUnit {
                entity = entity
            }
                );
            entityManager.AddComponentData <HexCoordinates>(selectEntity, coordinates);
        }