Beispiel #1
0
    int buildingsCount;                                                  //кол-во установленных зданий

    // Use this for initialization
    void Start()
    {
        scriptGUIItemsController = gameObject.GetComponent <GUIItemsController>();

        myBuildingsList = new List <ConstructData> [scriptGUIItemsController.packsTypesCount];

        for (byte i = 0; i < scriptGUIItemsController.packsTypesCount; i++)        //симуляция внесения списка из сервера
        {
            //Нулевая и Первая ячейки массива структуры это координаты здания
            //Вторая - ёмкость кристаллов
            //Третья - Запас на данный момент
            //Прибыль здания
            //Пятая - Есть ли модификатор у здания(на пример,пухи)

            myBuildingsList[i] = new List <ConstructData>();

            if (i != 24 && i != 25 && i != 20)
            {
                for (byte j = 0; j < Random.Range(0, 2); j++)
                {
                    myBuildingsList[i].Add(new ConstructData());
                    myBuildingsList[i][j].paramArray = new short[6] {
                        (short)Random.Range(0, 2048), (short)Random.Range(0, 2048), 1000, (short)Random.Range(20, 1000), 0, 0
                    };
                }
            }
        }
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        chankLoaderObj = GameObject.Find("ChunkLoader");
        chunkLoad      = chankLoaderObj.GetComponent <ChankLoad>();

        characterObj    = GameObject.Find("Сharacter");
        chancSpawnerObj = GameObject.Find("ChunkSpawner");
        characterDataAndGUIControllers = GameObject.Find("CharacterDataAndGUIControllers");
        guiItemsController             = characterDataAndGUIControllers.GetComponent <GUIItemsController>();

        if (loadSprites)
        {
            loadSprites   = false;
            debugGFXAtlas = new Color[44][];
            {
                debugGFXAtlas[0]  = terrainTiles.GetPixels(0, 160, tileResolution, tileResolution);
                debugGFXAtlas[1]  = terrainTiles.GetPixels(0, 128, tileResolution, tileResolution);
                debugGFXAtlas[2]  = terrainTiles.GetPixels(16, 128, tileResolution, tileResolution);
                debugGFXAtlas[3]  = terrainTiles.GetPixels(32, 128, tileResolution, tileResolution);
                debugGFXAtlas[4]  = terrainTiles.GetPixels(48, 128, tileResolution, tileResolution);
                debugGFXAtlas[5]  = terrainTiles.GetPixels(64, 128, tileResolution, tileResolution);
                debugGFXAtlas[6]  = terrainTiles.GetPixels(80, 48, tileResolution, tileResolution);
                debugGFXAtlas[7]  = terrainTiles.GetPixels(32, 48, tileResolution, tileResolution);
                debugGFXAtlas[8]  = terrainTiles.GetPixels(7 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[9]  = terrainTiles.GetPixels(1 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[10] = terrainTiles.GetPixels(7 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[11] = terrainTiles.GetPixels(6 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[12] = terrainTiles.GetPixels(10 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[13] = terrainTiles.GetPixels(11 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[14] = terrainTiles.GetPixels(12 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[15] = terrainTiles.GetPixels(13 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[16] = terrainTiles.GetPixels(14 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[17] = terrainTiles.GetPixels(15 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[18] = terrainTiles.GetPixels(11 * 16, 5 * 16, tileResolution, tileResolution);
                debugGFXAtlas[19] = terrainTiles.GetPixels(12 * 16, 5 * 16, tileResolution, tileResolution);
                debugGFXAtlas[20] = terrainTiles.GetPixels(13 * 16, 5 * 16, tileResolution, tileResolution);
                debugGFXAtlas[21] = terrainTiles.GetPixels(14 * 16, 5 * 16, tileResolution, tileResolution);
                debugGFXAtlas[22] = terrainTiles.GetPixels(0 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[23] = terrainTiles.GetPixels(1 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[24] = terrainTiles.GetPixels(2 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[25] = terrainTiles.GetPixels(3 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[26] = terrainTiles.GetPixels(4 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[27] = terrainTiles.GetPixels(6 * 16, 5 * 16, tileResolution, tileResolution);
                debugGFXAtlas[28] = terrainTiles.GetPixels(3 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[29] = terrainTiles.GetPixels(5 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[30] = terrainTiles.GetPixels(4 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[31] = terrainTiles.GetPixels(3 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[32] = terrainTiles.GetPixels(6 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[33] = terrainTiles.GetPixels(4 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[34] = terrainTiles.GetPixels(2 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[35] = terrainTiles.GetPixels(7 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[36] = terrainTiles.GetPixels(5 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[37] = terrainTiles.GetPixels(6 * 16, 4 * 16, tileResolution, tileResolution);
                debugGFXAtlas[38] = terrainTiles.GetPixels(9 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[39] = terrainTiles.GetPixels(1 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[40] = terrainTiles.GetPixels(0 * 16, 7 * 16, tileResolution, tileResolution);
                debugGFXAtlas[41] = terrainTiles.GetPixels(8 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[42] = terrainTiles.GetPixels(10 * 16, 3 * 16, tileResolution, tileResolution);
                debugGFXAtlas[43] = terrainTiles.GetPixels(10 * 16, 5 * 16, tileResolution, tileResolution);
            }            //Инициализация всех видов блоков
        }


        //BuildMesh();
        BuildTexture();

        mesh_rendererChunk = GetComponent <MeshRenderer>();
        textureChunk       = (Texture2D)mesh_rendererChunk.sharedMaterial.mainTexture;
    }