public GameMechanics(string src) { gameField = new GameField(src); beatManager = new BeatTimings(src); timeLine = new TimeLine(beatManager.GetTimings()); TimeLine.isActive = false; // mainCamera = GameObject.Find("Main Camera"); isGameStarted = false; isGamePlaying = false; state = (TextMesh)GameObject.Find("State").GetComponent <TextMesh>(); if (GameObject.Find("BeatLight")) { beatLight = GameObject.Find("BeatLight").GetComponent <BeatLight>() as BeatLight; } pauseScreen = GameObject.FindGameObjectWithTag("PauseScreen").GetComponent <PauseScriptEnable>(); pauseScreen.Init(); navigation = GameObject.Find("_Navigation").GetComponent <Navigation>(); navigation.enabled = false; }
/// <summary> /// 设置箭头,计算分数 /// </summary> /// <param name="type"></param> void SetArrowResult(Global.TIMING_JUAGE_TYPE type, Arrow arrow, bool isMainBeat = true) { switch (type) { case Global.TIMING_JUAGE_TYPE.BAD: Sounder.instance.Play("BAD音效"); break; } if (arrow.isLastOne) { bool end = true; if (arrow is LongPressArrow) { LongPressArrow longPress = arrow as LongPressArrow; switch (longPress.subState) { case Arrow.STATE.PRESSING: case Arrow.STATE.READY: end = false; break; } } if (hp > 0 && end) { ClearnArrow(); Eff.instance.lastHit.SetActive(true); BeatGame.instance.ArrowComplete(); } } if (type != Global.TIMING_JUAGE_TYPE.MISS) { int comboTime = combo.GetCount(); GetComponent <AudioSource>().volume = comboTime < 10 ? 0.7f : 1; if (isMainBeat) { GetComponent <AudioSource>().PlayOneShot(leftRightClip); } } timingJudge.Show(type); if (type < Global.TIMING_JUAGE_TYPE.BAD) { AddCombo(type); BeatLight bl = null; switch (arrow.songTime.direction) { case SongInfo.DIRECTION.LEFT: bl = leftLight; break; case SongInfo.DIRECTION.RIGHT: bl = rightLight; break; case SongInfo.DIRECTION.UP: bl = upLight; break; case SongInfo.DIRECTION.DOWN: bl = downLight; break; } bl.Show(); Eff.instance.ScreenHit(arrow.songTime.direction); } else { //道具 if (correctProp != null && DataUtils.mode == Global.MODE.MODE_1P) { if (correctProp.Use()) { Sounder.instance.Play("道具消耗音效"); AddCombo(Global.TIMING_JUAGE_TYPE.PREFECT); Eff.instance.ScreenHit(arrow.songTime.direction); type = Global.TIMING_JUAGE_TYPE.PREFECT; } else { combo.Reset(); } } else { combo.Reset(); } switch (type) { case Global.TIMING_JUAGE_TYPE.BAD: mark += 5; //bad加5 break; case Global.TIMING_JUAGE_TYPE.MISS: RefreshHP(); break; } } scoreData.AddJuade(info.data, type); markText.SetValue(mark); }