用户:
坦率的血翼蝠5801查看:1 回复:2 评论:1 创建时间:2022-04-10T17:13:48
先打开场景-全局特效-飘雪,然后在代码区输入
let seasonDuration = 1000 * 15 // 单位是毫秒:1秒 = 1000 毫秒
for(let x = 0; x<256; x++){
for(let y = 0; y<256; y++){
for(let z = 0; z<256;z++)
if(voxels.getVoxel(x, y, z) === voxels.id('grass')){
voxels.setVoxel(x, y, z, 'white_grass')
}
}
}
async function seasonChange(){
while(true){
world.say('春季来临')
for(let x = 0; x<256; x++){
for(let y = 0; y<256; y++){
for(let z = 0; z<256;z++)
if(voxels.getVoxel(x, y, z) === voxels.id('white_grass')){
voxels.setVoxel(x, y, z, 'grass')
}
}
}
world.snowTexture = 'snow/leaf.part'
world.snowColor = new Box3RGBAColor(0.91, 0.3, 0.53, 1);
await sleep(seasonDuration)
world.say('夏季来临')
for(let x = 0; x<256; x++){
for(let y = 0; y<256; y++){
for(let z = 0; z<256;z++)
if(voxels.getVoxel(x, y, z) === voxels.id('grass')){
voxels.setVoxel(x, y, z, 'rock')
}
}
}
world.snowColor = new Box3RGBAColor(0, 0, 0, 0);
await sleep(seasonDuration)
world.say('秋季来临')
for(let x = 0; x<256; x++){
for(let y = 0; y<256; y++){
for(let z = 0; z<256;z++)
if(voxels.getVoxel(x, y, z) === voxels.id('rock')){
voxels.setVoxel(x, y, z, 'yellow_grass')
}
}
}
world.snowTexture = 'snow/maple.part'
world.snowColor = new Box3RGBAColor(3,3,0, 1);
await sleep(seasonDuration)
world.say('冬季来临')
for(let x = 0; x<256; x++){
for(let y = 0; y<256; y++){
for(let z = 0; z<256;z++)
if(voxels.getVoxel(x, y, z) === voxels.id('yellow_grass')){
voxels.setVoxel(x, y, z, 'white_grass')
}
}
}
world.snowTexture = 'snow/snow2.part'
world.snowColor = new Box3RGBAColor(1,1,1, 1);
await sleep(seasonDuration)
}
}
seasonChange() //调用函数