コード例 #1
0
 public void RandomDynamicData()
 {
     mDynamicDataDic.Clear();
     for (int i = 0; i < mTileConfigDatas.GetLength(0); ++i)
     {
         for (int j = 0; j < mTileConfigDatas.GetLength(1); ++j)
         {
             MapTileConfigType tileType = MapTileConfigBase.DecodeTileType(mTileConfigDatas [i, j]);
             if (tileType == MapTileConfigType.Free)
             {
                 int value = Random.Range(0, 1);
                 MapTileDynamicBase dynamicData = null;
                 if (value == 0)
                 {
                     dynamicData = new MapTileDynamicCity();
                 }
                 else
                 {
                     dynamicData = new MapTileDynamicTribe();
                 }
                 mDynamicDataDic[TileCoordToTileKey(i, j)] = dynamicData;
             }
         }
     }
 }
コード例 #2
0
    public MapTileConfigBase GetTileConfig(int x, int y)
    {
        if (!IsValidTileCoord(x, y))
        {
            return(null);
        }
        int tileData = mTileConfigDatas [x, y];
        MapTileConfigType tileType = MapTileConfigBase.DecodeTileType(tileData);
        MapTileConfigBase ret      = null;

        switch (tileType)
        {
        case MapTileConfigType.Block:
            ret = new MapTileConfigBlock();
            break;

        case MapTileConfigType.Free:
            ret = new MapTileConfigFree();
            break;

        default:
            break;
        }
        ret.tileCoord = new IntVector2(x, y);
        ret.Decode(tileData);
        return(ret);
    }
コード例 #3
0
    public bool IsBlock(int x, int y)
    {
        if (!IsValidTileCoord(x, y))
        {
            return(true);
        }
        int tileData = mTileConfigDatas [x, y];
        MapTileConfigType tileType = MapTileConfigBase.DecodeTileType(tileData);

        return(tileType == MapTileConfigType.Block);
    }
コード例 #4
0
    void InitTile(int x, int y)
    {
        MapTileConfigBase configBase = MapDataManager.Instance.GetTileConfig(x, y);
        int tileKey = MapDataManager.TileCoordToTileKey(x, y);

        switch (configBase.tileType)
        {
        case MapTileConfigType.Block:
            MapTileBlock tileBlock = new MapTileBlock(mCacheTransform);
            mTileDic.Add(tileKey, tileBlock);
            tileBlock.SetConfigData(configBase);
            tileBlock.Refresh();
            break;

        case MapTileConfigType.Free:
        {
            MapTileDynamicBase dynamicData = MapDataManager.Instance.GetTileDynamicData(x, y);
            if (null != dynamicData)
            {
                switch (dynamicData.TileType)
                {
                case MapTileDynamicType.City:
                    break;

                case MapTileDynamicType.Tribe:
                    break;

                default:
                    break;
                }
            }
        }
        break;

        default:
            break;
        }
    }
コード例 #5
0
 public void SetConfigData(MapTileConfigBase configData)
 {
     mConfigData = configData;
 }