예제 #1
0
        public EntityReference GetEntityReference(Entity entity)
        {
            var guid = m_WorldManager.GetEntityGuid(entity);

            if (guid == Guid.Empty)
            {
                return(null);
            }

            k_References.TryGetValue(guid, out var reference);
            return(reference);
        }
예제 #2
0
        public EntityNode FindNode(Entity entity)
        {
            var guid = m_WorldManager.GetEntityGuid(entity);

            if (guid == Guid.Empty)
            {
                return(null);
            }

            return(FindNode(guid));
        }
예제 #3
0
        public EntityNode(ISceneGraph graph, Session session, Entity entity)
            : base(graph)
        {
            m_Session        = session;
            m_WorldManager   = m_Session.GetManager <IWorldManager>();
            m_EntityManager  = m_WorldManager.EntityManager;
            m_ComponentCache = m_Session.GetManager <UnityComponentCacheManager>();

            Entity = entity;
            Guid   = m_WorldManager.GetEntityGuid(entity);

            if (m_EntityManager.HasComponent <SiblingIndex>(Entity))
            {
                Index = m_EntityManager.GetComponentData <SiblingIndex>(Entity);
            }
            else
            {
                Index = new SiblingIndex {
                    Index = int.MaxValue
                };
                m_EntityManager.AddComponentData(Entity, Index);
            }
        }