import FoShanDianHan from "./FoShanDianHan"; import SingleNote from "./SingleNote"; const {ccclass, property} = cc._decorator; @ccclass export default class NoteLines extends cc.Component { @property(cc.Prefab) singleNote: cc.Prefab = null; @property(cc.Node) maskArea: cc.Node = null; // @property(cc.Node) // judgeArea: cc.Node = null; @property(cc.Node) startNode: cc.Node = null; @property(cc.Node) endNode: cc.Node = null; @property(cc.Node) keyArea: cc.Node = null; notes:cc.Node[] = []//进入轨道的所有note beatMap = []//该轨道的所有note的谱面 noteGenerateTimes = []//生成note的时间 currentNote=0//下一个待加入轨道的note noteToJudge=0//下一个被触发的note lastNoteToJudge=0//队列尾 nodePerfectTime = 0 // checkPosY = 0//节点至少需要下落至该点才能检测 gameSpeed:number = 1000//note速度,单位:像素每秒 foShanDianHanInstance = null onLoad () { // this.musicDuration = this.node.getComponent(cc.AudioSource).getDuration(); let nodeSlideLength = Math.abs(this.startNode.x-this.endNode.x) this.nodePerfectTime = nodeSlideLength/this.gameSpeed; this.foShanDianHanInstance = FoShanDianHan.getInstance() } // onKeyDown(event){ // this.judgeNote(); // } initData(){ this.currentNote = 0 this.noteToJudge = 0 this.lastNoteToJudge = 0 } judgeNote(){ //当下标小于数组长度且游戏出于playing状态 if(this.noteToJudgethis.foShanDianHanInstance.missTime){ // this.notes[this.noteToJudge++].getComponent(SingleNote).miss(); // } } } }