Esempio n. 1
0
    public void ConstructGird()
    {
        this.m_GridSpriteList = new List <tk2dSprite>();
        for (int i = 0; i < ClientSystemConstants.BUILDING_TILE_MAP_SIZE.height; i++)
        {
            for (int j = 0; j < ClientSystemConstants.BUILDING_TILE_MAP_SIZE.width; j++)
            {
                if (BattleMapData.Instance.GridArray[i, j] != GridType.Out)
                {
                    float      depth      = this.m_GridPrefab.transform.position.z;
                    GameObject gridObject = (GameObject)ObjectPoolController.InstantiateWithoutPool(this.m_GridPrefab);                    //GameObject.Instantiate(this.m_GridPrefab) as GameObject;
                    Vector3    position   = PositionConvertor.GetWorldPositionFromBuildingTileIndex
                                                (new TilePosition(j, i));
                    gridObject.transform.position = new Vector3(position.x, position.y, depth);
                    gridObject.transform.parent   = this.m_ParentNode;
                    tk2dSprite gridSprite = gridObject.GetComponentInChildren <tk2dSprite>();
                    gridSprite.spriteId = gridSprite.GetSpriteIdByName(BattleMapData.Instance.GridArray[i, j].ToString());
                    this.m_GridSpriteList.Add(gridSprite);
                }
            }
        }

        this.DisplayGrid();
    }