ToVector3() public method

public ToVector3 ( ) : Vector3
return Vector3
Beispiel #1
0
    public TerrainChunk CreateChunk(ChunkPos pos)
    {
        if (_chunks.ContainsKey(pos))
            throw new InvalidOperationException(string.Format(
                "Chunk at {0} already exists", pos));

        var chunkObject = new GameObject("Chunk: " + pos) {
            hideFlags = HideFlags.HideInHierarchy };
        var chunk = chunkObject.AddComponent<TerrainChunk>();

        chunk.terrain = this;
        chunk.position = pos;

        chunk.transform.parent = transform;
        chunk.transform.localPosition = pos.ToVector3();
        chunk.transform.localRotation = Quaternion.identity;
        chunk.transform.localScale = Vector3.one;

        _chunks[pos] = chunk;
        return chunk;
    }