Example #1
0
 protected override void Render(IEntity entity, CurrentPositionComp positionComp, float interpolation)
 {
     if (FOVComp.IsVisibleByPlayer(positionComp))
     {
         base.Render(entity, positionComp, interpolation);
     }
 }
Example #2
0
 protected override void Render(IEntity entity, T positionComp, float interpolation)
 {
     if (FOVComp.HasBeenSeenOrRevealed(positionComp))
     {
         base.Render(entity, positionComp, interpolation);
     }
 }
Example #3
0
        public override void Init(Game game)
        {
            Game = game;

            var playerEntity = Game
                               .Entities
                               .GetWithComponent <PlayerComp>()
                               .Single();

            PlayerComp    = playerEntity.GetComponent <PlayerComp>();
            PlayerPosComp = playerEntity.GetComponent <CurrentPositionComp>();

            FOVComp = Game.Entities.GetSingleComponent <FOVComp>();
            var boardComp = Game.Entities.GetSingleComponent <BoardComp>();

            FOVComp.Init(boardComp, PlayerComp);
        }
Example #4
0
        private void CreateBuffer(IRenderizable game, IntPtr boardTexture)
        {
            FOVComp = game.Entities.GetSingleComponent <FOVComp>();

            var boardComp = game.Entities.GetSingleComponent <BoardComp>();

            BoardSize = boardComp.BoardSize.Multiply(BoardComp.TILE_SIZE);

            BoardBufferTexture = SDL_CreateTexture(
                UxContext.WRenderer,
                SDL_PIXELFORMAT_RGBA8888,
                (int)SDL_TextureAccess.SDL_TEXTUREACCESS_TARGET,
                BoardSize.Width,
                BoardSize.Height
                );
            SDL_SetTextureBlendMode(BoardBufferTexture, SDL_BlendMode.SDL_BLENDMODE_BLEND);
            SDL_SetRenderTarget(UxContext.WRenderer, BoardBufferTexture);

            using var tileRenderer = new TileRenderer(UxContext, game);
            var tileEntities = game.Entities.GetWithComponent <TileComp>();

            tileRenderer.Render(tileEntities, 0);

            using var wallRenderer = new WallRenderer(UxContext, game, boardTexture);
            var wallEntities = game.Entities.GetWithComponent <IWallComp>();

            wallRenderer.Render(wallEntities, 0);

            using var downStairsRenderer = new DownStairsRenderer(UxContext, game, boardTexture);
            var downStairEntities = game.Entities.GetWithComponent <DownStairsComp>();

            downStairsRenderer.Render(downStairEntities, 0);

            using var upStairsRenderer = new UpStairsRenderer(UxContext, game, boardTexture);
            var upStairsEntities = game.Entities.GetWithComponent <UpStairsComp>();

            upStairsRenderer.Render(upStairsEntities, 0);

            SDL_SetRenderTarget(UxContext.WRenderer, IntPtr.Zero);
        }
Example #5
0
 public override void Init(Game game)
 {
     base.Init(game);
     FOVComp   = game.Entities.GetSingleComponent <FOVComp>();
     BoardComp = game.Entities.GetSingleComponent <BoardComp>();
 }