Esempio n. 1
0
    /// <summary>
    /// CREATE THE MESHES HERE THIS TIME AND GIVE IT TO CHUNK
    /// </summary>
    /// <param name="position"> IN WORDLD SPACE </param>
    public Sector(Vector3Int position, Node parent) : base(parent)
    {
        //base._uSize = _suSize;
        _position = position;
        _chunks   = new Chunk[_sSize, _sSize, _sSize];
        Vector3Int pos = Vector3Int.zero;

        _blockData = new BlockData[_suSize, _suSize, _suSize];

        CreateSectorAction csa = new CreateSectorAction(this);

        Parameters.ChunkActionData sad = new Parameters.ChunkActionData(position, _sSize);

        CreateChunksAction       cChunk = new CreateChunksAction(csa, sad);
        CreateBlockDataAction    cbda   = new CreateBlockDataAction(csa);
        TerraformBlockDataAction tfbda  = new TerraformBlockDataAction(csa);

        for (int i = 0; i < _suSize; i++)
        {
            for (int j = 0; j < _suSize; j++)
            {
                for (int k = 0; k < _suSize; k++)
                {
                    cbda.Add2Que(new Pair <Vector3Int, Vector3Int>(_position, new Vector3Int(i, j, k)));
                }
            }
        }

        csa.AddAction(0, cChunk);
        csa.AddAction(1, cbda);
        csa.AddAction(2, tfbda);
        csa.AddAction(3, new CreateMeshAction(csa));
        ActionQue.Add2Que(csa);

        /*
         * GameObject chunkParent = new GameObject(position.x + " " + position.y + " " + position.z);
         * for (int i = 0; i < _sSize; i++) {
         *      for (int j = 0; j < _sSize; j++) {
         *              for (int k = 0; k < _sSize; k++) {
         *                      pos.x = i * Chunk._uSize;
         *                      pos.y = j * Chunk._uSize;
         *                      pos.z = k * Chunk._uSize;
         *                      _chunks[i, j, k] = new Chunk(pos + position, this, chunkParent.transform);
         *              }
         *      }
         * }
         * _depth = 666;
         *
         *
         * //CreateBlockData();
         *
         */
    }
Esempio n. 2
0
 public CreateChunksAction(ActionNode parent, Parameters.ChunkActionData data)
 {
     _parent     = (CreateSectorAction)parent;
     _parameters = data;
 }