public IEnumerator EnterFinisherMode(bool usedSwordGrapple) { GameStatus.FinisherModeActive = true; Player.GetComponent <PlayerMovementController>().PreventMoving(); Player.GetComponent <PlayerMovementController>().PreventTuring(); inFinisherMode = true; print("Begin Finisher"); swordController.PreventAttacking(); //move enemy into place and lock controls. PlayerRotWrapper.LookAt(new Vector3(currentTarget.transform.position.x, PlayerRotWrapper.transform.position.y, currentTarget.transform.position.z)); if (!PillarFinisherUsed) { if (currentTarget.tag != "TargetDummy") { currentTarget.GetComponent <EnemyMovementController>().StopMovement(); currentTarget.GetComponent <EnemyAI>().BeingFinished(); if (currentTarget.GetComponent <EnemyTypeController>().MyEnemyType == EnemyType.Boss) { savedAnimController = currentTarget.GetComponent <EnemyAI>().anim.runtimeAnimatorController; } if (enemyAnimator = currentTarget.GetComponent <EnemyAI>().anim) { enemyAnimator.runtimeAnimatorController = enemyAnimatorController; enemyAnimator.updateMode = AnimatorUpdateMode.UnscaledTime; enemyAnimator.Play("Finisher_Start"); } yield return(null); } } UIanim.Play("FinisherRunicIdleStance"); Time.timeScale = slowMoModifier; if (usedSwordGrapple) { //moves camera cam.MoveToAimingLocation(true); //Mark make sure camera takes as long as the animation usedSwordGrapple = false; //move sword forward and back over a small period SwordThrowAnimObj.SetActive(true); var savedSwordPos = SwordThrowAnimObj.transform.localPosition; var savedSwordRot = SwordThrowAnimObj.transform.localRotation; var currentSwordPos = SwordThrowAnimObj.transform.position; Vector3 FinalTarget = EnemyFinisherPlacement.position; float timeToMove = .25f; var t = 0f; while (t < 1) { t += Time.unscaledDeltaTime / timeToMove; SwordThrowAnimObj.transform.position = Vector3.Lerp(currentSwordPos, currentTarget.transform.position, t); yield return(null); } currentSwordPos = SwordThrowAnimObj.transform.position; var currentTargetPos = currentTarget.transform.position; t = 0f; while (t < 1) { t += Time.unscaledDeltaTime / timeToMove; SwordThrowAnimObj.transform.position = Vector3.Lerp(currentSwordPos, FinalTarget, t); currentTarget.transform.position = Vector3.Lerp(currentTargetPos, FinalTarget, t); yield return(null); } SwordThrowAnimObj.transform.localPosition = savedSwordPos; SwordThrowAnimObj.transform.localRotation = savedSwordRot; SwordThrowAnimObj.SetActive(false); CharAnim.Play("Finisher_Start"); yield return(null); } else { CharAnim.Play("Finisher_Start"); yield return(null); } currentTarget.transform.position = EnemyFinisherPlacement.position; currentTarget.transform.rotation = EnemyFinisherPlacement.rotation; if (!PillarFinisherUsed) { currentTarget.transform.Rotate(new Vector3(0, -40, 0)); } //currentTarget.transform.parent = EnemyFinisherPlacement; if (PillarFinisherUsed) { currentTarget.transform.position += Vector3.down; TutorialPopups.Instance.ShowTutorialPopup(PillarTutorial.FinisherUnlock); } //moves camera cam.MoveToFinisherModeLocation(); //Mark make sure camera takes as long as the animation if (PillarFinisherUsed) { PillarTutorial.PlayFirstHit(); } while (cam.GetIsMoving()) { CameraBase.rotation = Quaternion.Slerp(CameraBase.rotation, PlayerRotWrapper.rotation, .5f); yield return(null); } //waits till the camera and or animation is done CameraBase.rotation = PlayerRotWrapper.rotation; GetComponent <PlayerMovementController>().Aiming = false; PerformingFinisher = true; FinisherCount = FinisherTime; FinisherIcon.SetActivated(false); InFinisherIcons.SetActive(true); if (!PillarFinisherUsed) { RunicRinisherGuides.SetActive(true); } //RunicSequence.RestartQue(); RunicQue.Clear(); InputList.Clear(); //yield return null; }
IEnumerator PerformGodMode() { GetComponent <FinisherMode>().CanFinish = false; bool timeRanOut = false; bool firstEnemy = true; bool swipeLeft = true; int kills = 0; List <GameObject> Enemies = GetEnemies(); GameObject closestEnemy = null; //Enemies = BuildPathOfFoes(Enemies); if (Enemies.Count > 0) { pmc.PreventMoving(); pmc.PreventTuring(); GameStatus.FinisherModeActive = true; CharAnim.Play("Carve 1"); //Enter animation closestEnemy = FindClosestEnemy(Enemies); //Go throug the nearby enemies while (kills < 5) { if (timeRanOut) { break; } if (firstEnemy) { //MARK: play an animation?? also make invulnerable //moves camera cmc.MoveToFinisherModeLocation(); //Mark make sure camera takes as long as the animation while (cmc.GetIsMoving()) { yield return(null); } Time.timeScale = 0; firstEnemy = false; GetComponent <PlayerMovementController>().Aiming = false; } if (closestEnemy != null) { CharAnim.Play("Idle"); //Go To enemy //Prompt for button press //if failed break out //Perform Quick Finisher StartCoroutine(MoveToEnemy(closestEnemy, .15f)); yield return(new WaitForSecondsRealtime(.3f)); ChoseInput(); while (!CheckUserInput()) //returns true if the right button is pressed, so stop the while loop { if (GodModeCount >= GodModeTimer) // break out if they are taking too long { timeRanOut = true; break; } GodModeCount += Time.unscaledDeltaTime; yield return(null); } HideInputs(); if (swipeLeft) { CharAnim.Play("Attack 1"); swipeLeft = false; } else { CharAnim.Play("Attack 2"); swipeLeft = true; } yield return(new WaitForSecondsRealtime(.4f)); //GameObject part1 = Instantiate(TopHalf, new Vector3(closestEnemy.transform.position.x, transform.position.y, closestEnemy.transform.position.z), closestEnemy.transform.rotation); //GameObject part2 = Instantiate(BottomHalf, new Vector3(closestEnemy.transform.position.x, transform.position.y - 1f, closestEnemy.transform.position.z), closestEnemy.transform.rotation); GodModeSlider.value -= 34; if (closestEnemy.tag != "TargetDummy") { closestEnemy.GetComponent <EnemyAI>().KillEnemy(); closestEnemy.GetComponent <EnemyTypeController>().MyEnemyType = EnemyType.Boss; // todo my code sucks } else { Destroy(closestEnemy); } GetComponent <FinisherMode>().IncreaseFinisherMeter(20); kills++; if (timeRanOut) { break; } yield return(null); Enemies = GetEnemies(); if (Enemies.Count <= 0) { break; } closestEnemy = FindClosestEnemy(Enemies); } } } Time.timeScale = 1; GetComponent <FinisherMode>().CanFinish = true; cmc.SwitchCombatLocation(); pmc.AllowMoving(); pmc.AllowTurning(); GameStatus.FinisherModeActive = false; CharAnim.Play("Idle"); yield return(null); }