猫史档案馆


无人机代码(Pro)

用户:天天fUg-天天fUg-查看:0 回复:0 评论:0 创建时间:2024-05-18T15:15:15


const a = world.querySelector('#控制台-3')   
const b = world.querySelector('#无人机pro-1')
const c = world.querySelector('#天窗-1')
var speedx1 = 0
var speedy1 = 0
var speedz1 = 0
a.enableInteract = true
a.interactRadius = 8
a.onInteract(async({entity})=>{
    const e = await entity.player.dialog({
        type:GameDialogType.SELECT,
        content:`无人机当前位置:\nx:${b.position.x}\ny:${b.position.y}\nz:${b.position.z}`,
        options:["上升","下降","左移","右移","向前","向后","急刹车","无人机摄像头","关闭无人机摄像头","无人机返航","打喵","关闭天窗"]
    })
    if(e){
        if(e.index === 0){
            speedy1 = 0.3
        }
        if(e.index === 1){
            speedy1 = -0.3
        }
        if(e.index === 2){
            speedx1 = 0.3
        }
        if(e.index === 3){
            speedx1 = -0.3
        }
        if(e.index === 4){
            speedz1 = 0.3
        }
        if(e.index === 5){
            speedz1 = -0.3
        }
        if(e.index === 6){
            speedy1 = 0
            speedx1 = 0
            speedz1 = 0
        }
        if(e.index === 9){
            speedy1 = 0
            speedx1 = 0
            speedz1 = 0
            b.position.set(109.80078125,10.29296875,173.69140625)
        }
        if(e.index === 10){
        c.position.x-=15
        }
        if(e.index === 11){
        c.position.x+=15
        }
        if(e.index === 7){
            entity.sj = 1
            while(1){
                if(entity.sj != 1)
                    break;
                entity.player.cameraEntity = b
                await sleep(1)
            }
        }
        if(e.index === 8){
            entity.player.cameraEntity = entity
            entity.player.cameraMode='follow';//设置视角为跟随
            entity.sj = 0
        }
    }
})
async function wrjcz(){
    while(1){
        if(b.position.y <= 10){
            b.position.y += 0.3
            speedy1 = 0
        }
        b.velocity.y = speedy1
        b.velocity.z = speedz1
        b.velocity.x = speedx1
        await sleep(10)
    }
}
wrjcz()



回复

上一页1 页 / 共 0下一页