/// <summary> /// 玩家有一个操作,表现的玩家就做一个动作 /// </summary> /// <param name="actionType"></param> public void DoAction(int _iIndex) { if (!m_musicManager.IsPlaying()) { return; } if (m_scoringManager.temper < ScoringManager.temperThreshold)//-如果兴奋值比较低就一直播放点头的动作 { m_newPlayerAction[_iIndex] = PlayerActionEnum.HeadBanging; } else//-如果比较兴奋了就按照脚本的动作 { int iNearest = m_scoringManager.GetNearestPlayerActionInfoIndex(_iIndex); m_newPlayerAction[_iIndex] = m_musicManager.currentSongInfo.onBeatActionSequence[_iIndex][iNearest].playerActionType; } //获取当前在哪个拍子按下来了 OnBeatActionInfo actionInfo = new OnBeatActionInfo(); actionInfo.triggerBeatTiming = m_musicManager.beatCountFromStart; actionInfo.playerActionType = m_newPlayerAction[_iIndex]; m_lastActionInfo[_iIndex] = actionInfo; #if PLAYER //-播放相应的动画 if (actionType == PlayerActionEnum.HeadBanging) { gameObject.GetComponent <SimpleSpriteAnimation>().BeginAnimation(2, 1, false); } else if (actionType == PlayerActionEnum.Jump) { gameObject.GetComponent <SimpleActionMotor>().Jump(); gameObject.GetComponent <SimpleSpriteAnimation>().BeginAnimation(1, 1, false); } #endif }