private void Move(Vector2 dir) { if (bInputDetectionActive) { bool valid = (gameManager.musicHandler.ValidateBeat() && gameManager.bBeatInput == false); bool obstruction = false; bool enemy = false; bool successfulInput = false; if (gameManager.currentGamePhase == "move") { if (valid) { ITileInfo tileInfo = m_player.DoMove(dir); switch (tileInfo.GetState()) { case TileState.Occupied: obstruction = true; break; case TileState.Ennemy: enemy = true; break; } if (!obstruction) { successfulInput = true; if (enemy) { if (!tileInfo.GetWorldObject().GetComponent <DV_EnemyAnimation>().bWokenUp) { gameManager.BeginDanceSequence(tileInfo); } } } else { gameManager.discoController.OnFailBeat(); } } else { gameManager.discoController.OnFailBeat(); } } else { string moveDirection; if (dir.x == 0f) { if (dir.y > 0f) { moveDirection = "Up"; } else { moveDirection = "Down"; } } else { if (dir.x > 0f) { moveDirection = "Right"; } else { moveDirection = "Left"; } } successfulInput = valid && gameManager.danceSequence.CheckStepValidityAgainstInput(moveDirection, danceStepIndex); if (successfulInput) { gameManager.danceSequence.ValidateStep(danceStepIndex); danceStepIndex++; if (danceStepIndex >= 4) { gameManager.SucceedDanceSequence(); } } else { gameManager.danceSequence.ResetDanceSequence(); danceStepIndex = 0; gameManager.discoController.OnFailBeat(); } } if (successfulInput) { anim.AnimationStep(); } else { gameManager.MissBeatDamage(); } gameManager.ValidateBeat(successfulInput); } }