Beispiel #1
0
    public void SetColor(byte[] _colorChannelIndices, bool _isPermanent)
    {
        Int2 _tileGridPosTL, _tileGridPosTR, _tileGridPosBR, _tileGridPosBL;

        NeighborFinder.GetSurroundingTiles(GridPos, out _tileGridPosTL, out _tileGridPosTR, out _tileGridPosBR, out _tileGridPosBL);

        if (_tileGridPosTR != Int2.MinusOne)
        {
            GameGrid.GetInstance().SetColor(_tileGridPosTR, _colorChannelIndices, _isPermanent);
        }
    }
Beispiel #2
0
    public void ClearTemporaryColor()
    {
        Int2 _tileGridPosTL, _tileGridPosTR, _tileGridPosBR, _tileGridPosBL;

        NeighborFinder.GetSurroundingTiles(GridPos, out _tileGridPosTL, out _tileGridPosTR, out _tileGridPosBR, out _tileGridPosBL);

        // if (_tileTL != null){
        //  _tileTL.ClearTemporaryColor();
        // }
        if (_tileGridPosTR != Int2.MinusOne)
        {
            GameGrid.GetInstance().ClearTemporaryColor(_tileGridPosTR);
        }
        // if (_tileBR != null){
        //  _tileBR.ClearTemporaryColor();
        // }
        // if (_tileBL != null){
        //  _tileBL.ClearTemporaryColor();
        // }
    }
Beispiel #3
0
    public void ScheduleUpdateGraphicsForSurroundingTiles()
    {
        ColorManager.ColorUsage _context = ColorManager.ColorUsage.Default;

        if (UseIsWallTemporary && IsWallTemporarily)
        {
            _context = ColorManager.ColorUsage.New;
        }
        if (UseIsWallTemporary && !IsWallTemporarily)
        {
            _context = ColorManager.ColorUsage.Delete;
        }

        if (UseAttachedInteractiveObjectTemporary && AttachedInteractiveObjectTemporary != null)
        {
            _context = ColorManager.ColorUsage.New;

            if (AttachedInteractiveObject != null)
            {
                _context = ColorManager.ColorUsage.Blocked;
            }
        }
        if (UseAttachedInteractiveObjectTemporary && AttachedInteractiveObjectTemporary == null)
        {
            _context = ColorManager.ColorUsage.Delete;
        }

        byte _colorIndex = ColorManager.GetColorIndex(_context);

        byte[] _colorChannelIndices = new byte[ColorManager.COLOR_CHANNEL_COUNT] {
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex,
            _colorIndex
        };

        Int2 _tileGridPosTL, _tileGridPosTR, _tileGridPosBR, _tileGridPosBL;

        NeighborFinder.GetSurroundingTiles(GridPos, out _tileGridPosTL, out _tileGridPosTR, out _tileGridPosBR, out _tileGridPosBL);

        if (_tileGridPosTR != Int2.MinusOne)
        {
            GameGrid.GetInstance().ScheduleUpdateForTileAsset(_tileGridPosTR);
            UpdateTileColor(_tileGridPosTR, _colorChannelIndices);
            SetTileVertexLighting(_tileGridPosTR, lightingTR, _vertexIndex: GameGridMesh.VERTEX_INDEX_BOTTOM_LEFT);
        }
        if (_tileGridPosBL != Int2.MinusOne)
        {
            GameGrid.GetInstance().ScheduleUpdateForTileAsset(_tileGridPosBL);
            UpdateTileColor(_tileGridPosBL, _colorChannelIndices);
            SetTileVertexLighting(_tileGridPosBL, lightingBL, _vertexIndex: GameGridMesh.VERTEX_INDEX_TOP_RIGHT);
        }
        if (_tileGridPosTL != Int2.MinusOne)
        {
            GameGrid.GetInstance().ScheduleUpdateForTileAsset(_tileGridPosTL);
            UpdateTileColor(_tileGridPosTL, _colorChannelIndices);
            SetTileVertexLighting(_tileGridPosTL, lightingTL, _vertexIndex: GameGridMesh.VERTEX_INDEX_BOTTOM_RIGHT);
        }
        if (_tileGridPosBR != Int2.MinusOne)
        {
            GameGrid.GetInstance().ScheduleUpdateForTileAsset(_tileGridPosBR);
            UpdateTileColor(_tileGridPosBR, _colorChannelIndices);
            SetTileVertexLighting(_tileGridPosBR, lightingBR, _vertexIndex: GameGridMesh.VERTEX_INDEX_TOP_LEFT);
        }
    }