public GameEntity CreateEntity(string name)
        {
            var entity = _basePool.CreateEntity(name);

            _additionalEntities.Add(entity);
            return(entity);
        }
예제 #2
0
        public override void Start(ScreenHandler screen)
        {
            base.Start(screen);

            doorOne = _entityPool.CreateEntity(JoinInfo.bossEntityName);
            doorTwo = _entityPool.CreateEntity(JoinInfo.bossEntityName);

            doorOne.GetComponent <PositionComponent>().SetPosition(new PointF(doorOneX, doorOneY));
            doorTwo.GetComponent <PositionComponent>().SetPosition(new PointF(doorTwoX, doorTwoY));

            doorOne.Start(container);
            doorTwo.Start(container);

            doorOne.GetComponent <StateComponent>().StateChanged += s =>
            {
                if (s == "Open")
                {
                    open = true;
                }
            };
        }
예제 #3
0
        public void Start()
        {
            if (!blocks.Any())
            {
                foreach (Common.BlockInfo blockinfo in info.Blocks)
                {
                    BlockInfo myInfo = new BlockInfo {
                        entity = _entityPool.CreateEntity(info.Entity)
                    };
                    // should always persist off screen
                    PositionComponent pos = myInfo.entity.GetComponent <PositionComponent>();
                    pos.PersistOffScreen = true;
                    myInfo.pos           = new PointF(blockinfo.pos.X, blockinfo.pos.Y);
                    myInfo.on            = blockinfo.on;
                    myInfo.off           = blockinfo.off;
                    blocks.Add(myInfo);
                }
            }

            this.playerPos       = container.Entities.GetEntityById("Player").GetComponent <PositionComponent>();
            container.GameThink += Update;
            stopped              = false;
        }