コード例 #1
0
        void CreateEntityPlayer(EntitiesPool pool)
        {
            var playerEntity = _context.CreateEntity();

            playerEntity.AddComponent(new Player());
            playerEntity.AddComponent(new EntityLinkComponent()
            {
                LinkToEntity = _context.Find(PoolMatcher.Inventory).First()
            });
        }
コード例 #2
0
        void CreateEntityInventory(EntitiesPool pool)
        {
            var inventoryEntity = _context.CreateEntity();
            var allGuns         = pool.Find(PoolMatcher.Guns);

            inventoryEntity.AddComponent(new Inventory());
            inventoryEntity.AddComponent(new EntityLinkComponent()
            {
                LinksToEntity = new List <Entity>(allGuns)
            });
        }
コード例 #3
0
        void CreateEntitiesGuns(EntitiesPool pool)
        {
            var gunEntity = _context.CreateEntity();

            gunEntity.AddComponent(new Gun());
            gunEntity.AddComponent(new ComponentLinkToSilencer()
            {
                LinkToEntity = _context.Find(PoolMatcher.Silencer).First()
            });
            gunEntity.AddComponent(new ComponentLinkToRearSight()
            {
                LinkToEntity = _context.Find(PoolMatcher.RealSight).First()
            });

            //почти аналогичный код для второго оружия
        }
コード例 #4
0
        void CreateEntityRearSight(EntitiesPool pool)
        {
            var realSightComponent = new RearSight();

            pool.CreateEntityAndAddComponent(realSightComponent, _countEntity);
        }
コード例 #5
0
        void CreateEntitySilencer(EntitiesPool pool)
        {
            var silencerComponent = new Silencer();

            pool.CreateEntityAndAddComponent(silencerComponent, _countEntity);
        }