[LayaAir 2.0]3D场景跳转到2D场景问题
跳转到2D场景时如何删除3D场景,3D场景玩家 上面的代码:
onCollisionEnter(other){
if(other.other.owner.name==="end"){
// this.owner.parent.removeSelf();
//删除自身场景
console.log(this.owner.parent)
console.log(this.owner.parent.parent);
//创建胜利的UI界面
let victoryScene=new VictoryScene();
Laya.stage.addChild(victoryScene);
this.isDelete=true;
// console.log(Scene3DControl.GameSceneB);
}
}结束界面跳转到3D场景
import {VictorySceneUI} from '../ui/layaMaxUI'
import GameScene from './GameScene';
export default class VictoryScene extends VictorySceneUI {
constructor() {
super();
}
onAwake(){
let btnOnce=this.getChildByName("btnOnce");
btnOnce.on(Laya.Event.CLICK,this,this.onClick);
}
onClick(e){
this.removeSelf();
let gameScene=new GameScene();
Laya.stage.addChild(gameScene);
}
}
求大佬教学
onCollisionEnter(other){
if(other.other.owner.name==="end"){
// this.owner.parent.removeSelf();
//删除自身场景
console.log(this.owner.parent)
console.log(this.owner.parent.parent);
//创建胜利的UI界面
let victoryScene=new VictoryScene();
Laya.stage.addChild(victoryScene);
this.isDelete=true;
// console.log(Scene3DControl.GameSceneB);
}
}结束界面跳转到3D场景
import {VictorySceneUI} from '../ui/layaMaxUI'
import GameScene from './GameScene';
export default class VictoryScene extends VictorySceneUI {
constructor() {
super();
}
onAwake(){
let btnOnce=this.getChildByName("btnOnce");
btnOnce.on(Laya.Event.CLICK,this,this.onClick);
}
onClick(e){
this.removeSelf();
let gameScene=new GameScene();
Laya.stage.addChild(gameScene);
}
}
求大佬教学
要回复问题请先登录
0 个回复