Example #1
0
        protected override void OnUpdate()
        {
            LatiosWorld lw = World as LatiosWorld;

            if (!lw.pauseForSceneLoad)
            {
                base.OnUpdate();
            }
        }
 public void CopyData(Entity src, Entity dst, ComponentType componentType)
 {
     //Check to ensure dst has componentType
     if (!m_em.HasComponent(dst, componentType))
     {
         m_em.AddComponent(dst, componentType);
     }
     if (componentType.IsSharedComponent)
     {
         CopyScd(src, dst, componentType);
     }
     else if (componentType.IsBuffer)
     {
         CopyBuffer(src, dst, componentType);
     }
     else
     {
         bool handled = false;
         var  type    = componentType.GetManagedType();
         if (type.IsConstructedGenericType)
         {
             var genType = type.GetGenericTypeDefinition();
             if (genType == typeof(ManagedComponentTag <>))
             {
                 if (!m_typeTagsToTypesCache.TryGetValue(type, out Type managedType))
                 {
                     managedType = type.GenericTypeArguments[0];
                     m_typeTagsToTypesCache[type] = managedType;
                 }
                 LatiosWorld lw = m_em.World as LatiosWorld;
                 lw.ManagedStructStorage.CopyComponent(src, dst, managedType);
                 handled = true;
             }
             else if (genType == typeof(CollectionComponentTag <>))
             {
                 if (!m_typeTagsToTypesCache.TryGetValue(type, out Type managedType))
                 {
                     managedType = type.GenericTypeArguments[0];
                     m_typeTagsToTypesCache[type] = managedType;
                 }
                 LatiosWorld lw = m_em.World as LatiosWorld;
                 lw.CollectionComponentStorage.CopyComponent(src, dst, managedType);
                 handled = true;
             }
             else if (genType == typeof(ManagedComponentSystemStateTag <>) || genType == typeof(CollectionComponentSystemStateTag <>))
             {
                 handled = true;
             }
         }
         if (!handled)
         {
             CopyIcd(src, dst, componentType);
         }
     }
 }
Example #3
0
 protected sealed override void OnCreate()
 {
     if (World is LatiosWorld lWorld)
     {
         latiosWorld = lWorld;
     }
     else
     {
         throw new InvalidOperationException("The current world is not of type LatiosWorld required for Latios framework functionality.");
     }
     OnCreateInternal();
 }
Example #4
0
        protected sealed override void OnCreate()
        {
            base.OnCreate();
            if (World is LatiosWorld lWorld)
            {
                latiosWorld = lWorld;
            }
            else
            {
                throw new InvalidOperationException("The current world is not of type LatiosWorld required for Latios framework functionality.");
            }
            CreateSystems();

            EnableSystemSorting &= !latiosWorld.useExplicitSystemOrdering;
        }
Example #5
0
        protected sealed override void OnCreate()
        {
            base.OnCreate();
            if (World is LatiosWorld lWorld)
            {
                latiosWorld = lWorld;
            }
            else
            {
                throw new InvalidOperationException("The current world is not of type LatiosWorld required for Latios framework functionality.");
            }
            CreateSystems();
            foreach (var s in Systems)
            {
                m_systems.Add(s);
            }
            SortSystems();
            var unitySystems = Systems as List <ComponentSystemBase>;

            unitySystems.Clear();
            unitySystems.AddRange(m_systems);
            m_initialized = true;
        }
Example #6
0
 private static CollectionComponentStorage GetCollectionStorage(EntityManager em, out LatiosWorld latiosWorld)
 {
     if (!(em.World is LatiosWorld lw))
     {
         throw new InvalidOperationException("The EntityManager must belong to a LatiosWorld in order to use ICollectionComponent");
     }
     latiosWorld = lw;
     return(latiosWorld.CollectionComponentStorage);
 }