コード例 #1
0
        void CreateEntity()
        {
            if (entity != null)
            {
                RecycleEntity();
            }

            entity = entityManager.CreateEntity(groups, enabled);

            for (int i = 0; i < children.Length; i++)
            {
                entity.AddChild(children[i].Entity);
            }

            entity.AddAll(components);
            entity.AddAll(componentBehaviours);

            // Activate components
            for (int i = 0; i < componentBehaviours.Length; i++)
            {
                var component = componentBehaviours[i];

                if (component.Active && component.Entity != null)
                {
                    component.OnActivated();
                }
            }
        }
コード例 #2
0
        void CreateEntity()
        {
            if (entity != null)
                RecycleEntity();

            entity = entityManager.CreateEntity(groups, enabled);

            for (int i = 0; i < children.Length; i++)
                entity.AddChild(children[i].Entity);

            entity.AddAll(components);
            entity.AddAll(componentBehaviours);

            // Activate components
            for (int i = 0; i < componentBehaviours.Length; i++)
            {
                var component = componentBehaviours[i];

                if (component.Active && component.Entity != null)
                    component.OnActivated();
            }
        }