Exemplo n.º 1
0
    private void Light_Cast(int move, Array_Index Index, Tile tile, bool isFirst) //tile은 현재 선택된 타일, isFirst는 루프 횟수가 처음인가 판별
    {
        int tileX = tile.x;                                                       // 현재 타일의 가로축 인덱스
        int tileY = tile.y;                                                       // 현재 타일의 세로축 인덱스

        if (!Set_Able_TIle_LIst.Contains(tile) && isFirst == false)
        {
            Set_Able_TIle_LIst.Add(tile);
            //if(move)
            //tex.SetPixel(Index.x, Index.y, new Color(1f, 0f, 0f, 0.5f));
        }

        isFirst = false;

        if (move <= 0)      //move가 0이되면 탈출
        {
            return;
        }

        Tile upTile    = MapManager.GetTile(tileX, tileY + 1);
        Tile downtile  = MapManager.GetTile(tileX, tileY - 1);
        Tile leftTile  = MapManager.GetTile(tileX - 1, tileY);
        Tile rightTile = MapManager.GetTile(tileX + 1, tileY);


        if (!MapManager.Is_Block_Object(upTile.Tile_Sort) &&
            upTile.Sight_Sort == Sight_Sort.White)
        {
            Light_Cast(move - 1, new Array_Index(Index.x, Index.y + 1), upTile, isFirst);
        }

        if (!MapManager.Is_Block_Object(downtile.Tile_Sort) &&
            downtile.Sight_Sort == Sight_Sort.White)
        {
            Light_Cast(move - 1, new Array_Index(Index.x, Index.y - 1), downtile, isFirst);
        }

        if (!MapManager.Is_Block_Object(leftTile.Tile_Sort) &&
            leftTile.Sight_Sort == Sight_Sort.White)
        {
            Light_Cast(move - 1, new Array_Index(Index.x - 1, Index.y), leftTile, isFirst);
        }

        if (!MapManager.Is_Block_Object(rightTile.Tile_Sort) &&
            rightTile.Sight_Sort == Sight_Sort.White)
        {
            Light_Cast(move - 1, new Array_Index(Index.x + 1, Index.y), rightTile, isFirst);
        }
    }
Exemplo n.º 2
0
 public void Set_Tile(MapManager mapmanager, Array_Index array_index)
 {
     this.MapManager  = mapmanager;
     this.Array_Index = array_index;
     //this.Nomal_Object.gameObject.transform.localScale = new Vector3(0.95f, 0.95f, 1f);
 }