Inheritance: MonoBehaviour
Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        enemySprite  = GetComponentInChildren <SpriteRenderer>();
        anim         = GetComponent <Animator>();
        objectPooler = ObjectPooler.Instance;
        bfs          = BattlefieldScript.Instance;
        status       = GetComponent <EntityStatus>();
        ray          = new Ray(transform.position, transform.forward);

        if (Physics.Raycast(ray, out hit, 10f))
        {
            Debug.DrawRay(transform.position, -transform.up);

            previousRaycastTile      = hit.transform.gameObject;
            previousRaycastTileClass = previousRaycastTile.GetComponent <TileClass>();
            previousRaycastTileClass.SetColour(enemyTileColour);
            currentTile = hit.transform.gameObject;
        }


        currentTileClass = currentTile.GetComponent <TileClass>();

        currentGridPosition = new Vector2(currentTileClass.gridLocation.x, currentTileClass.gridLocation.y);

        enemySprite.sortingOrder = -(int)currentTileClass.gridLocation.y + 5;

        currentTileClass.occupied = true;
    }
 void Update()
 {
     if (GameManager.instance.currentGameState == GameManager.GameStates.PausedState)
     {
         return;
     }
     //SelectedTile listi için, 3 tane varolan image'ı dolrurur ve world pozisyonlarını bu listenin içindeki tileların world pozisyonlarıyla doldurur.
     if (selectedTiles.tileList.Count == 3)
     {
         for (int i = 0; i < selectedTileImages.Count; i++)
         {
             selectedTileImages[i].SetActive(true);
             TileClass selectedTile = selectedTiles.tileList[i];
             Vector3   worldPos     = tilemap.CellToWorld(new Vector3Int(selectedTile.x, selectedTile.y, 1));
             selectedTileImages[i].transform.position = worldPos;
         }
     }
     else
     {
         for (int i = 0; i < selectedTileImages.Count; i++)
         {
             selectedTileImages[i].SetActive(false);
         }
     }
 }
    void CreateGrid()
    {
        int i = 0;

        for (float x = mCenter.x - (mTileCount * mTileSize) / 2; x < mCenter.x + (mTileCount * mTileSize) / 2; x += mTileSize)
        {
            mTiles.Add(new List <TileClass>());
            for (float y = mCenter.y - (mTileCount * mTileSize) / 2; y < mCenter.y + (mTileCount * mTileSize) / 2; y += mTileSize)
            {
                GameObject obj = Instantiate <GameObject>(baseTile);
                obj.transform.position                       = new Vector3(x, y, 0);
                obj.GetComponent <TileObject>().x            = i;
                obj.GetComponent <TileObject>().y            = mTiles[i].Count;
                obj.GetComponent <TileObject>().mGridManager = this;
                TileClass t = new TileClass();
                t.gameObject = obj;
                t.distance   = 0;
                mTiles[i].Add(t);
            }
            ++i;
        }
        float
            startX = (mCenter.x + (mTileCount * mTileSize) / 2),
            startY = (mCenter.y + (mTileCount * mTileSize) / 2) - mTileSize,
            endX   = (mCenter.x - (mTileCount * mTileSize) / 2) - mTileSize,
            endY   = (mCenter.y - (mTileCount * mTileSize) / 2);

        mStart = Instantiate <GameObject>(mStartTilePrefab, new Vector3(startX, startY, 0), Quaternion.identity);
        mStart.GetComponent <SpriteRenderer>().color = new Color(0, 1, 0);
        mEnd = Instantiate <GameObject>(mEndTilePrefab, new Vector3(endX, endY, 0), Quaternion.identity);
        mEnd.GetComponent <SpriteRenderer>().color = new Color(0, 0, 1);

        GetPathToEnd();
    }
Beispiel #4
0
    IEnumerator SwitchTilesRoutine(TileClass clickedTile, TileClass targetTile)
    {
        if (m_playerInputEnabled)
        {
            Piece clickedPiece = m_allPieces[clickedTile.xIndex, clickedTile.yIndex];
            Piece targetPiece  = m_allPieces[targetTile.xIndex, targetTile.yIndex];
            if (clickedPiece != null && targetPiece != null)
            {
                clickedPiece.Move(targetTile.xIndex, targetTile.yIndex, swapTime);
                targetPiece.Move(clickedTile.xIndex, clickedTile.yIndex, swapTime);
                yield return(new WaitForSeconds(swapTime));


                List <Piece> clickedPieceMatches = FindMatchesAt(clickedTile.xIndex, clickedTile.yIndex);
                List <Piece> targetPieceMatches  = FindMatchesAt(targetTile.xIndex, targetTile.yIndex);

                if (targetPieceMatches.Count == 0 && clickedPieceMatches.Count == 0)
                {
                    clickedPiece.Move(clickedTile.xIndex, clickedTile.yIndex, swapTime);
                    targetPiece.Move(targetTile.xIndex, targetTile.yIndex, swapTime);
                }
                else
                {
                    yield return(new WaitForSeconds(swapTime));

                    ClearAndRefillBoard(clickedPieceMatches.Union(targetPieceMatches).ToList());
                    turnsLeftText.text = turnsLeft.ToString();
                }
            }
        }
    }
Beispiel #5
0
    void RayCheck(Ray ray)
    {
        if (Physics.Raycast(ray, out hit, 10f))
        {
            Debug.DrawRay(transform.position, -transform.up);
            if (previousRaycastTile == null)
            {
                previousRaycastTile = hit.transform.gameObject;
                currentRaycastTile  = hit.transform.gameObject;

                TileClass _previousRaycastTileClass = previousRaycastTile.GetComponent <TileClass>();
                _previousRaycastTileClass.SetColour(playerTileColour);
            }
            else
            {
                if (hit.transform.gameObject != currentRaycastTile | currentRaycastTile.GetComponent <TileClass>().currentColour != playerTileColour)
                {
                    previousRaycastTile.GetComponent <TileClass>().SetColour(previousRaycastTile.GetComponent <TileClass>().initialMaterialColour, false, false, true);

                    currentRaycastTile = hit.transform.gameObject;
                    currentRaycastTile.GetComponent <TileClass>().SetColour(playerTileColour);
                    previousRaycastTile = currentRaycastTile;
                }
            }
        }
        else
        {
            if (previousRaycastTile != null)
            {
                previousRaycastTile.GetComponent <TileClass>().SetColour(previousRaycastTile.GetComponent <TileClass>().initialMaterialColour);
                previousRaycastTile = null;
            }
        }
    }
    public void Swipe()
    {
        anim.SetTrigger("Attack");
        TileClass tile = gameboard.GetTileAtCoordinate(transform.position.x, transform.position.y).GetComponent <TileClass>();

        if (!tile.HasWall(TileClass.NORTH))
        {
            Vector3 pos = new Vector2(transform.position.x, transform.position.y + 1);
            gameboard.AttackTile((int)pos.x, (int)pos.y);
            Instantiate(meleeobj, new Vector3((int)pos.x, (int)pos.y), Quaternion.Euler(0, 0, 90));
        }
        if (!tile.HasWall(TileClass.EAST))
        {
            Vector3 pos = new Vector2(transform.position.x + 1, transform.position.y);
            gameboard.AttackTile((int)pos.x, (int)pos.y);
            Instantiate(meleeobj, new Vector3((int)pos.x, (int)pos.y), Quaternion.identity);
        }
        if (!tile.HasWall(TileClass.SOUTH))
        {
            Vector3 pos = new Vector2(transform.position.x, transform.position.y - 1);
            gameboard.AttackTile((int)pos.x, (int)pos.y);
            Instantiate(meleeobj, new Vector3((int)pos.x, (int)pos.y), Quaternion.Euler(0, 0, -90));
        }
        if (!tile.HasWall(TileClass.WEST))
        {
            Vector3 pos = new Vector2(transform.position.x - 1, transform.position.y);
            gameboard.AttackTile((int)pos.x, (int)pos.y);
            Instantiate(meleeobj, new Vector3((int)pos.x, (int)pos.y), Quaternion.Euler(0, 0, 180));
        }
    }
    // Destroy a wall
    // (x, y) is the coordinate of the tile
    // direction is the direction from the tile where the wall should be destroyed
    public void DestroyWall(int x, int y, int direction)
    {
        TileClass  tile      = GetTileAtCoordinate(x, y).GetComponent <TileClass>();
        GameObject obj       = GetNeighbouringTile(x, y, direction);
        TileClass  otherTile = null;

        if (obj != null)
        {
            otherTile = obj.GetComponent <TileClass>();
        }
        GameObject wall = null;

        int opposite = TileClass.getOppositeDirection(direction);

        if (otherTile != null && otherTile.HasWall(opposite))
        {
            wall = otherTile.GetWall(opposite);
            otherTile.SetWall(opposite, null);
        }
        if (tile.HasWall(direction))
        {
            wall = tile.GetWall(direction);
            otherTile.SetWall(direction, null);
        }

        if (wall != null)
        {
            Destroy(wall);
        }
    }
Beispiel #8
0
    public void route_construction(string buildingName, TileClass target_tile)
    {
        setCurrent();
        int res;

        switch (buildingName)
        {
        case "Farm": res = Init_Farm(target_tile); break;

        case "Water Pump": res = Init_Waterpump(target_tile); break;

        case "Landfill": res = Init_Landfill(target_tile); break;

        case "Residential": res = Init_Residental(target_tile); break;

        case "Mine": res = Init_Mine(target_tile); break;

        default: return;
        }
        GameObject border;

        if (res == 0)
        {
            if (currentPlayer.name == "Player1")
            {
                border = Instantiate(P1Border, target_tile.gameObject.transform);
            }
            else
            {
                border = Instantiate(P2Border, target_tile.gameObject.transform);
            }
            border.transform.position = target_tile.transform.position + new Vector3(0, 0.05f, 0);
            GameObject.Find("UI").GetComponentInChildren <show_resources>().calcResourcePerTurn(currentPlayer.GetComponent <PlayerStats>());
        }
    }
Beispiel #9
0
 public void DragToTile(TileClass tile)
 {
     if (m_clickedTile != null && IsNextTo(tile, m_clickedTile))
     {
         m_targetTile = tile;
     }
 }
Beispiel #10
0
    public void SetTileInfo(int x, int y)
    {
        previousTile = currentTile;

        currentTile         = bfs.battleTilesGrid[(int)currentTileClass.gridLocation.x + x, (int)currentTileClass.gridLocation.y + y];
        currentTileClass    = currentTile.GetComponent <TileClass>();
        currentGridPosition = currentTileClass.gridLocation;
    }
Beispiel #11
0
    void deleteTile(int target)
    {
        //Debug.Log("target : " + target);
        TileClass temp = findTileClass(target);

        temp.destroyTile();
        tileObjectList.Remove(temp);
    }
    //Rastgele bir tileda bomba spawn etmeye yarar.
    public void SpawnBomb()
    {
        TileClass tileToSpawnBombOn = allTiles.tileList[UnityEngine.Random.Range(0, allTiles.tileList.Count - 1)];

        tileToSpawnBombOn.isItBombTile = true;
        isBombActive.value             = true;
        bombActionCount.value          = numberOfActionsBeforeBombExplodes;
    }
Beispiel #13
0
 public void ClickTile(TileClass tile)
 {
     if (m_clickedTile == null)
     {
         m_clickedTile = tile;
         Debug.Log("Clicked tile " + tile.name);
     }
 }
Beispiel #14
0
 public void ReleaseTile()
 {
     if (m_clickedTile != null && m_targetTile != null)
     {
         SwitchTiles(m_clickedTile, m_targetTile);
     }
     m_clickedTile = null;
     m_targetTile  = null;
 }
    private void bfs(Queue <Utility.Coord> cellQueue, int i, int distance, int movementCells, bool[,] visitedMap)
    {
        while (cellQueue.Count > 0 && distance <= movementCells * 2)
        {
            Utility.Coord currentCell = cellQueue.Dequeue();


            Debug.Log(currentCell.x + " " + currentCell.y);
            if (currentCell.x >= 0 && currentCell.x < mapSize.x && currentCell.y >= 0 && currentCell.y < mapSize.y)
            {
                tileclass = map[currentCell.x, currentCell.y].GetComponent <TileClass>();
                if (tileclass.getType() != 2 && distance <= movementCells)
                {
                    //paint blue
                    Debug.Log("Cell " + currentCell.x + " " + currentCell.y + " is painted BLUE");
                    //cellQueue.Enqueue(currentCell);

                    if (tileclass.getType() == 1)
                    {
                        distance += 2;
                    }
                    else
                    {
                        distance++;
                    }

                    for (int j = 0; j < 8; j++)
                    {
                        cellQueue.Enqueue(currentCell.Add(neighbours[i]));
                        bfs(cellQueue, j, distance, movementCells, visitedMap);
                    }
                }
                else if (tileclass.getType() != 2 && distance <= movementCells * 2)
                {
                    //paint yellow
                    Debug.Log("Cell " + currentCell.x + " " + currentCell.y + " is painted YELLOW");
                    //cellQueue.Enqueue(currentCell);

                    if (tileclass.getType() == 1)
                    {
                        distance += 2;
                    }
                    else
                    {
                        distance++;
                    }

                    for (int j = 0; j < 8; j++)
                    {
                        cellQueue.Enqueue(currentCell.Add(neighbours[i]));
                        bfs(cellQueue, j, distance, movementCells, visitedMap);
                    }
                }
            }
        }
    }
Beispiel #16
0
    void FillPath(TileClass _dest)
    {
        MapManager.ResetPath();
        TileClass current = _dest;

        while (current != null)
        {
            MapManager.SetPathTo(current.position);
            current = current.previous;
        }
    }
    // Update is called once per frame
    void LateUpdate()
    {
        if (isPaused == false)
        {
            rb.velocity = new Vector3(speed, 0, 0);
            ray         = new Ray(transform.position, transform.forward);
            if (Physics.Raycast(ray, out hit, 10f))
            {
                GameObject _hitTile = hit.transform.gameObject;
                if (previousTile == null)
                {
                    previousTile     = _hitTile;
                    currentTile      = previousTile;
                    currentTileClass = currentTile.GetComponent <TileClass>();
                    if (_hitTile.GetComponent <TileClass>().occupied != true)
                    {
                        currentTileClass.SetColour(Color.yellow, false, true);
                    }
                    tr.sortingOrder = -(int)currentTileClass.gridLocation.y + 5;
                }
                else if (currentTile != _hitTile | currentTileClass.currentColour != Color.yellow)
                {
                    if (_hitTile.GetComponent <TileClass>().occupied != true)
                    {
                        if (currentTile.GetComponent <TileClass>().occupied != true)
                        {
                            previousTile      = currentTile;
                            previousTileClass = previousTile.GetComponent <TileClass>();
                            previousTileClass.SetColour(previousTileClass.initialMaterialColour);
                        }
                        currentTile = _hitTile;

                        currentTileClass = currentTile.GetComponent <TileClass>();

                        currentTileClass.SetColour(Color.yellow, false, true, false, 5);
                        tr.sortingOrder = -(int)currentTileClass.gridLocation.y + 5;
                    }
                }
            }
            else
            {
                if (previousTile != null)
                {
                    previousTile      = currentTile;
                    previousTileClass = previousTile.GetComponent <TileClass>();
                    previousTileClass.SetColour(previousTileClass.initialMaterialColour);
                    previousTile      = null;
                    previousTileClass = null;
                    currentTile       = null;
                    currentTileClass  = null;
                }
            }
        }
    }
Beispiel #18
0
    private float CalculateDistanceBetweenTileAndWorldPos(TileClass tile, Vector3 worldPos)
    {
        float distance = 0.0f;

        Vector3Int tilePosition           = new Vector3Int(tile.x, tile.y, -10);
        Vector3    tileWorldSpacePosition = tilemap.GetCellCenterWorld(tilePosition);

        distance = Vector2.Distance(tileWorldSpacePosition, worldPos);

        return(distance);
    }
Beispiel #19
0
    void moveTile(TileClass tile_class, int col, int row)
    {
        int position = col * this.col + row;

        if (tile_class.getPosition() != position)
        {
            tile_class.setPosition(position);
            //tile_class.getTile().transform.position = getTilePosition(position);
            moveViewTile(tile_class, position);
            creatable_init_tile = true; // 초기 타일 생성 가능
        }
    }
Beispiel #20
0
 bool IsNextTo(TileClass start, TileClass end)
 {
     if (Mathf.Abs(start.yIndex - end.yIndex) == 1 && start.xIndex == end.xIndex)
     {
         return(true);
     }
     if (Mathf.Abs(start.xIndex - end.xIndex) == 1 && start.yIndex == end.yIndex)
     {
         return(true);
     }
     return(false);
 }
Beispiel #21
0
    public void CreateTiles()
    {
        var total = tiles.Length;

         for (int i = 0; i < total; i ++)
        {
            var tile = new TileClass();
            tile.id = i;
            tiles[i] = tile;
        }
        FindNeighbours();
    }
Beispiel #22
0
    public List <TileClass> GetReachableTiles()
    {
        List <TileClass>  reachableTiles = new List <TileClass>();
        Queue <TileClass> openTiles      = new Queue <TileClass>();

        TileClass begin = new TileClass(m_gridPosition, TileType.Walkable, false);

        openTiles.Enqueue(begin);
        reachableTiles.Add(begin);

        bool isRightTeam = team == DataManager.instance.teamPlaying;

        for (int k = 0; k < MoveRange + AttackRange; k++)
        {
            int nbTile = openTiles.Count;
            for (int j = 0; j < nbTile; j++)
            {
                TileClass tile = openTiles.Dequeue();
                for (int i = 0; i < 4; i++)
                {
                    Vector3Int tilePos = tile.position + Utils.DirectionTile[i];
                    TileClass  newTile = new TileClass(tilePos);
                    newTile.previous = tile;
                    if (!reachableTiles.Contains(newTile) &&
                        (k >= MoveRange || Walkable(MapManager.GetZoneAtPosition(tilePos))))
                    {
                        reachableTiles.Add(newTile);

                        Hero occuper  = MapManager.GetHeroAtTile(tilePos);
                        bool hasEnemy = occuper != null && occuper.team != team;

                        if (k >= MoveRange || hasEnemy)
                        {
                            newTile.type    = TileType.Attackable;
                            newTile.enabled = isRightTeam && hasEnemy;
                        }
                        else
                        {
                            newTile.type    = TileType.Walkable;
                            newTile.enabled = isRightTeam && occuper == null;
                        }

                        if (!hasEnemy)
                        {
                            openTiles.Enqueue(newTile);
                        }
                    }
                }
            }
        }

        return(reachableTiles);
    }
Beispiel #23
0
    void combineTile(TileClass tile_class, int col, int row)
    {
        int position = col * this.col + row;

        createTile(tile_class.getValue(), position);

        deleteTile(tile_class.getPosition());
        deleteTile(position);

        moveViewTile(tile_class, position);

        creatable_init_tile = true; // 초기 타일 생성 가능
    }
 //hangi tilelların sileneceği flaglenir.
 public void SetDeleteTiles(TileClass tile, List <TileClass> sameColorTiles)
 {
     tilesToBeDeleted.Add(tile);
     tilesToBeDeleted.AddRange(sameColorTiles);
     tilesToCheck.Remove(tile);
     for (int i = 0; i < sameColorTiles.Count; i++)
     {
         tilesToCheck.RemoveAll(tile1 => tile1.x == sameColorTiles[i].x && tile1.y == sameColorTiles[i].y);
     }
     sameColorTiles.Clear();
     GameManager.instance.isTilesRotating = true;
     rotationTimer = totalRotationTime;
 }
 // Start is called before the first frame update
 public void onTileSelected(TileClass tile)
 {
     this.GetComponent <CanvasGroup>().alpha = 1f;
     transform.Find("TileInfo_Text").GetComponent <Text>().text = "\t" + tile.tileDescription;
     if (tile.polluAmount > tile.maxPolluAmount)
     {
         transform.Find("PollutionMeter/PollutionMeter_Bar").GetComponent <RectTransform>().localScale = new Vector3(tile.maxPolluAmount / tile.maxPolluAmount, 1.0f, 1.0f);
     }
     else
     {
         transform.Find("PollutionMeter/PollutionMeter_Bar").GetComponent <RectTransform>().localScale = new Vector3(tile.polluAmount / tile.maxPolluAmount, 1.0f, 1.0f);
     }
 }
Beispiel #26
0
 public int Init_Waterpump(TileClass target_tile)
 {
     if (currentPlayer.GetComponent <PlayerStats>().resources.z < 1.0f)
     {
         return(-1);
     }
     clone_waterpump = Instantiate(waterpump);
     clone_waterpump.transform.parent = target_tile.transform;
     clone_waterpump.GetComponent <Building>().setInitial();
     currentPlayer.GetComponent <PlayerStats>().buildings.Add(clone_waterpump);
     currentPlayer.GetComponent <PlayerStats>().resources.z -= 1.0f;
     return(0);
 }
 public void manageUI(TileClass tile)
 {
     Destroy(currentOptionList);
     if (tile != null)
     {
         print(tile.gameObject.name);
         //BroadcastMessage("onTileSelected", tile);
         //string[] optionList = tile.getOptions();
         string[] dummyoptionList = { "Worker", "Build", "Building" };
         currentOptionList = OPM.createOptionPanel("TileOption", gameObject, dummyoptionList, Camera.main.WorldToScreenPoint(tile.transform.position));
         Transform  tmp;
         GameObject buildOption;
         string[]   buildOptionList = { };
         GameObject workerOption;
         string[]   workerOptionList = { };
         GameObject buildingOption;
         string[]   buildingOptionList = { };
         ////////////////////////BUILD OPTION/////////////////////////////
         if (tmp = currentOptionList.transform.Find("Build"))
         {
             buildOption = tmp.gameObject;
             buildOption.GetComponent <Button>().onClick.AddListener(/*() => buildingOptionList = tile.getBuildingList()*/ () => { this.setActiveOption(buildOption); });
             //Change from parent option to child options
             buildOption = OPM.createOptionPanel("BuildOption", buildOption, dummyoptionList, buildOption.transform.position);
             buildOption.SetActive(false);
         }
         ////////////////////////WORKER OPTION///////////////////////////////
         if (tmp = currentOptionList.transform.Find("Worker"))
         {
             workerOption = tmp.gameObject;
             workerOption.GetComponent <Button>().onClick.AddListener(/*() =>workerOptionList = tile.getBuildingList()*/ () => { this.setActiveOption(workerOption); });
             //Change from parent option to child options
             workerOption = OPM.createOptionPanel("WorkerOption", workerOption, dummyoptionList, workerOption.transform.position);
             workerOption.SetActive(false);
         }
         ///////////////////////BUILDING OPTION/////////////////////////////////
         if (tmp = currentOptionList.transform.Find("Building"))
         {
             buildingOption = tmp.gameObject;
             buildingOption.GetComponent <Button>().onClick.AddListener(() => { this.setActiveOption(buildingOption); });
             //Change from parent option to child options
             buildingOption = OPM.createOptionPanel("BuildingOption", buildingOption, buildingOptionList, buildingOption.transform.position);
             buildingOption.SetActive(false);
         }
     }
     else
     {
         print("SPACE");
         //BroadcastMessage("onTileUnSelected");
     }
 }
Beispiel #28
0
    public TileClass GetTileClassAtCoordinate(int x, int y)
    {
        GameObject obj = GetTileAtCoordinate(x, y);

        if (obj != null)
        {
            TileClass tc = obj.GetComponent <TileClass>();
            if (tc != null)
            {
                return(tc);
            }
        }
        return(null);
    }
Beispiel #29
0
    public TileClass GetNeighbourTileClass(int x, int y, int direction)
    {
        GameObject obj = GetNeighbouringTile(x, y, direction);

        if (obj != null)
        {
            TileClass tc = obj.GetComponent <TileClass>();
            if (tc != null)
            {
                return(tc);
            }
        }
        return(null);
    }
    //Bir tile yokedilince, bu tileın üstündeki diğer tileları bir alta indirip, en üste yeni bir tile yaratır.
    public void AddNewTileToTop(TileClass DestroyedTile)
    {
        int tileX = DestroyedTile.x;
        int tileY = DestroyedTile.y;
        List <TileClass> tilesToGoDown = allTiles.tileList.Where(tile => tile.x > tileX && tile.y == tileY).ToList();

        for (int i = 0; i < tilesToGoDown.Count; i++)
        {
            tilesToGoDown[i].x -= 1;
        }
        Color     color     = colors[UnityEngine.Random.Range(0, colors.Count)];
        TileClass tileToAdd = new TileClass(color, numberOfRows.value - 1, tileY);

        allTiles.tileList.Add(tileToAdd);
    }
Beispiel #31
0
        public void addtheitems()
        {
            for (int i = 0; i < 6; i++)
            {
                //Create a new object
                TileClass obj = new TileClass();

                //add the title,notification and source from the sample data
                obj.title = arrayoftitle[i];
                obj.notification = arrayofnotification[i];
                obj.source = "Images/" + imagesource[i];

                //Group them into same category that is give them common tag called tiles
                obj.tag = "Tiles";

                mylistbox.Items.Add(obj);
            }
        }