void PlayerInputted(int trackNumber) { //check if multi-times node exists if (previousMusicNodes[trackNumber] != null) { //dispatch beat on hit event (multi-times node is always PERFECT) if (beatOnHitEvent != null) { beatOnHitEvent(trackNumber, Rank.PERFECT); } //check if the node should be removed if (previousMusicNodes[trackNumber].MultiTimesHit()) { //print("Multi-Times Succeed!"); previousMusicNodes[trackNumber] = null; } } else if (queueForTracks[trackNumber].Count != 0) { //peek the node in the queue MusicNode frontNode = queueForTracks[trackNumber].Peek(); if (frontNode.times > 0) { return; //multi-times node should be handled in the Update() func } float offsetY = Mathf.Abs(frontNode.gameObject.transform.position.y - finishLineY); if (offsetY < perfectOffsetY) //perfect hit { frontNode.PerfectHit(); //print("Perfect"); //dispatch beat on hit event if (beatOnHitEvent != null) { beatOnHitEvent(trackNumber, Rank.PERFECT); } queueForTracks[trackNumber].Dequeue(); } else if (offsetY < goodOffsetY) //good hit { frontNode.GoodHit(); //print("Good"); //dispatch beat on hit event if (beatOnHitEvent != null) { beatOnHitEvent(trackNumber, Rank.GOOD); } queueForTracks[trackNumber].Dequeue(); } else if (offsetY < badOffsetY) //bad hit { frontNode.BadHit(); //dispatch beat on hit event if (beatOnHitEvent != null) { beatOnHitEvent(trackNumber, Rank.BAD); } queueForTracks[trackNumber].Dequeue(); } } }
public void PlayerInputted(int trackNumber) { //Add Animation to the track if (queueForTracks[trackNumber].Count != 0) { //peek the node in the queue MusicNode frontNode = queueForTracks[trackNumber].Peek(); if (frontNode.times > 0) { return; //multi-times node should be handled in the Update() func } float offsetY = Mathf.Abs(frontNode.gameObject.transform.position.y - partitionManager.finishLineY); //Note porté minimum if (offsetY < partitionManager.badOffsetY) { if (frontNode.isStone) { BossManager.Instance.TriggerNextAttackStone(); int life = BossManager.Instance.GetStoneLife(); if (life > 0) { frontNode.updateSprite(life - 1); } } if (offsetY < partitionManager.perfectOffsetY) //perfect hit { //fait quelque chose sur le gameplay selon la qualité du hit frontNode.PerfectHit(); ChargeRole(PartitionManager.Rank.PERFECT); //SendBeatHit to particle if (HarmonieBar.Instance.GetMultiplier() == 2) { tracks[trackNumber].PlayParticle(PartitionManager.Rank.HARMONIE); } else { tracks[trackNumber].PlayParticle(PartitionManager.Rank.PERFECT); } //Harmonie if (PlayerManager.Instance.PlayersByRole(currentRole.RoleState) > 1) { HarmonieBar.Instance.GiveHarmonie(HARMONIEPerfect); } //Remove node queueForTracks[trackNumber].Dequeue(); } else if (offsetY < partitionManager.goodOffsetY) //good hit { //fait quelque chose sur le gameplay selon la qualité du hit frontNode.GoodHit(); ChargeRole(PartitionManager.Rank.GOOD); //SendBeatHit to particle if (HarmonieBar.Instance.GetMultiplier() == 2) { tracks[trackNumber].PlayParticle(PartitionManager.Rank.HARMONIE); } else { tracks[trackNumber].PlayParticle(PartitionManager.Rank.GOOD); } //Harmonie if (PlayerManager.Instance.PlayersByRole(currentRole.RoleState) > 1) { HarmonieBar.Instance.GiveHarmonie(HARMONIEGood); } //Remove node queueForTracks[trackNumber].Dequeue(); } else if (offsetY < partitionManager.badOffsetY) //bad hit { //fait quelque chose sur le gameplay selon la qualité du hit frontNode.BadHit(); ChargeRole(PartitionManager.Rank.BAD); //SendBeatHit to particle if (HarmonieBar.Instance.GetMultiplier() == 2) { tracks[trackNumber].PlayParticle(PartitionManager.Rank.HARMONIE); } else { tracks[trackNumber].PlayParticle(PartitionManager.Rank.BAD); } //Harmonie if (PlayerManager.Instance.PlayersByRole(currentRole.RoleState) > 1) { HarmonieBar.Instance.GiveHarmonie(HARMONIEBad); } //Remove node queueForTracks[trackNumber].Dequeue(); } } else { // ---> MISS : trop tot / trop tard ShieldBar.Instance.TakeDamage(8); player = PlayerManager.Instance.GetPlayer(idplayer); // Son en fct du perso if (player.Personnage.id == 0) { int i = Random.Range(1, 5); switch (i) { case 1: SoundMgr.Instance.PlaySound("FailPiano1"); break; case 2: SoundMgr.Instance.PlaySound("FailPiano2"); break; case 3: SoundMgr.Instance.PlaySound("FailPiano3"); break; case 4: SoundMgr.Instance.PlaySound("FailPiano4"); break; } } else if (player.Personnage.id == 1) { int i = Random.Range(1, 5); switch (i) { case 1: SoundMgr.Instance.PlaySound("FailBass1"); break; case 2: SoundMgr.Instance.PlaySound("FailBass2"); break; case 3: SoundMgr.Instance.PlaySound("FailBass3"); break; case 4: SoundMgr.Instance.PlaySound("FailBass4"); break; } } else if (player.Personnage.id == 2) { int i = Random.Range(1, 5); switch (i) { case 1: SoundMgr.Instance.PlaySound("FailGuitar1"); break; case 2: SoundMgr.Instance.PlaySound("FailGuitar2"); break; case 3: SoundMgr.Instance.PlaySound("FailGuitar3"); break; case 4: SoundMgr.Instance.PlaySound("FailGuitar4"); break; } } else if (player.Personnage.id == 3) { int i = Random.Range(1, 5); switch (i) { case 1: SoundMgr.Instance.PlaySound("FailBell1"); break; case 2: SoundMgr.Instance.PlaySound("FailBell2"); break; case 3: SoundMgr.Instance.PlaySound("FailBell3"); break; case 4: SoundMgr.Instance.PlaySound("FailBell4"); break; } } } } /* * else * { * //BarManager.Instance.GetImpact(currentRole, PartitionManager.Rank.MISS); * ChargeRole(PartitionManager.Rank.MISS); * }*/ }