咸鱼的反击
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

50 lines
1.2 KiB

import FoShanDianHan from "./FoShanDianHan";
const {ccclass, property} = cc._decorator;
@ccclass
export default class SingleNote extends cc.Component {
getSingleNoteBottomY(){
return this.node.y - (this.node.height/2)
}
onCollisionEnter (other,self) {
// this.node.destroy()
let tab = FoShanDianHan.getInstance().recordCollisionNodeTab
tab.push(self.node)
// console.log('onCollisionEnter',tab)
FoShanDianHan.getInstance().addAllYinFuNum()
}
onCollisionStay(other,self) {
}
onCollisionExit(other,self) {
let tab = FoShanDianHan.getInstance().recordCollisionNodeTab
for(let i=0;i<tab.length;i++){
if(tab[i].name == self.node.name){
tab.splice(i,1)
break
}
}
// let index = tab.indexOf(self.node.name)
// if(index > -1){
// tab.splice(index,1)
// }
if(self.node['isCollider']){
FoShanDianHan.getInstance().addJiKongNum()
FoShanDianHan.getInstance().refreshJiKongStr()
}
// console.log('onCollisionExit',tab)
this.node.destroy()
}
update (dt) {
if(FoShanDianHan.getInstance().gameState === 'playing')
{
this.node.x += dt* FoShanDianHan.getInstance().gameSpeed;
}
}
protected onLoad(): void {
// console.log('this.node.name==',this.node.name)
}
}