Exemple #1
0
    /// <summary>
    /// データ保持クラスの情報を元に、このクラスを初期化する。
    /// </summary>
    /// <param name="dataHolder">Data holder.</param>
    public void InitFromDataHolder(BlockDataHolder dataHolder)
    {
        this.breakCount = dataHolder.breakCount;
        this.hitScore   = dataHolder.hitScore;
        this.hitCount   = 0;

        this.gameObject.transform.localScale = new Vector3(dataHolder.width, 1, dataHolder.height);

        this.controller = GameObject.Find("MainController").GetComponent <MainController>();
        this.destroyer  = GameObject.Find("BlockDestroyer").GetComponent <BlockDestroyer>();

        //this.GetComponent<Renderer>().material = materialPrefabs [breakCount - 1];
    }
Exemple #2
0
    private void Start()
    {
        // Load BlockData from Json
        BlockDataHolder BlockInJson = JsonUtility.FromJson <BlockDataHolder>(jsonFile.text);

        foreach (BlockData bd in BlockInJson.BlockTypeData)
        {
            bd.LoadDataTags();
            bds.Add(bd);
            string TIDList = bd.GetTextureID(0, 0).ToString();
            for (int i = 1; i < 6; i++)
            {
                TIDList = TIDList + ", " + bd.GetTextureID(i, 0);
            }
            Debug.Log("Found Block: " + bd.name + " Solid: " + bd.render + " TID: " + TIDList + " EBD: " + bd.EBT.Length);
        }
        blockdata = bds.ToArray();

        // Load BiomeData from Json
        BiomeData BiomeInJson = JsonUtility.FromJson <BiomeData>(jsonFile2.text);
        int       index       = 0;

        foreach (BiomeDataSingle bd in BiomeInJson.biomedata)
        {
            Debug.Log("Found Biome: " + bd.Name + " SGH: " + bd.SolidGroundHeight + " TH: " + bd.TerrainHeight + " TS: " + bd.TerrainScale);
            biomedata[index, 0]     = bd.SolidGroundHeight;
            biomedata[index, 1]     = bd.TerrainHeight;
            biomedata[index, 2]     = bd.TerrainScale;
            structuredata[index, 0] = bd.StructureScale;
            structuredata[index, 1] = bd.StructureThreshold;
            structuredata[index, 2] = bd.StructurePlacementScale;
            structuredata[index, 3] = bd.StructurePlacementThreshold;
            structuredata[index, 4] = bd.maxStructureHeight;
            structuredata[index, 5] = bd.minStructureHeight;
            index++;
        }
        blockdata = bds.ToArray();

        // Actual Game-Stuff

        Random.InitState(seed);

        SpawnPosition = new Vector3(VoxelData.WorldSizeBlocks / 2f, VoxelData.ChunkHeight - 50, VoxelData.WorldSizeBlocks / 2f);
        GenerateWorld();
        LastChunk = getChunkCoord(Player.position);

        snap.setupsnap(this);
        StartCoroutine(Iconset());
    }