Пример #1
0
        /// <summary>
        /// Initializes the IconCollection
        /// Creates Orbitrings, TextIcons and Entityicons and adds them to Collection
        /// </summary>
        /// <param name="entities"></param>
        /// <param name="camera"></param>
        public void Init(IEnumerable <Entity> entities, Camera2dv2 camera)
        {
            IconDict.Clear();
            OrbitList.Clear();
            TextIconList.Clear();
            EntityList.Clear();
            scale = new ScaleIcon(camera);

            foreach (var item in entities)
            {
                if (item.HasDataBlob <OrbitDB>() && item.GetDataBlob <OrbitDB>().Parent != null)
                {
                    OrbitRing ring = new OrbitRing(item, camera);
                    OrbitList.Add(ring);
                }
                if (item.HasDataBlob <NameDB>())
                {
                    TextIconList.Add(new TextIcon(item, camera));
                }


                EntityIcon entIcon = new EntityIcon(item, camera);
                EntityList.Add(entIcon);


                IconDict.Add(item.Guid, entIcon);
            }
        }
Пример #2
0
        internal void AddNewIcon(Entity entity)
        {
            if (entity.HasDataBlob <OrbitDB>() && entity.GetDataBlob <OrbitDB>().Parent != null)
            {
                if (!entity.GetDataBlob <OrbitDB>().IsStationary)
                {
                    OrbitRing ring = new OrbitRing(entity, _camera);
                    OrbitList.Add(entity.Guid, ring);
                }
            }
            if (entity.HasDataBlob <NameDB>())
            {
                TextIconList.Add(entity.Guid, new TextIcon(entity, _camera));
            }

            EntityIcon entIcon = new EntityIcon(entity, _camera);

            EntityList.Add(entity.Guid, entIcon);
            IconDict.Add(entity.Guid, entIcon);
        }