protected override IEnumerator EventSequence() { if (!TutorialProgress.MechanicIsLearned(TutorialProgress.Mechanic.Attacking) && controlsHint != null) { Tween.Stop(controlsHint.GetInstanceID()); controlsHint.transform.localPosition = new Vector3(0f, -6.31f, 0f); Tween.Position(controlsHint.transform, controlsHint.transform.position + Vector3.up * 2f, 0.25f, 0f, Tween.EaseInOut); } enemy.MoveToTarget(endMarker.position.x); yield return(new WaitUntil(() => enemy.Dead || enemy.ReachedTarget)); if (!enemy.Dead) { PlayerController.Instance.CurrentEnemyTarget = enemy; enemy.RaiseWeapon(); float strikeTimer = 0f; while (strikeTimer < telegraphTime && !enemy.Dead) { strikeTimer += Time.deltaTime; yield return(new WaitForEndOfFrame()); } if (controlsHint != null) { Tween.Position(controlsHint.transform, controlsHint.transform.position + Vector3.up * -3f, 0.25f, 0f, Tween.EaseInOut); } if (!enemy.Dead) { enemy.Strike(); yield return(new WaitForSeconds(0.1f)); if (!enemy.Dead) { Survived = false; PlayerController.Instance.Anim.SetTrigger(playerDeathAnimation); PlayerController.Instance.Die(); yield return(new WaitForSeconds(0.3f)); yield break; } } yield return(new WaitForSeconds(0.25f)); TutorialProgress.LearnMechanic(TutorialProgress.Mechanic.Attacking); } }
protected override IEnumerator EventSequence() { bool learnedDucking = TutorialProgress.MechanicIsLearned(TutorialProgress.Mechanic.Ducking); if (learnedDucking) { AudioController.Instance.PlaySound2D("dodge"); yield return(new WaitForSeconds(0.25f)); } fallingSpear.gameObject.SetActive(true); Tween.Position(fallingSpear, landMarker.position, learnedDucking ? 1.1f : 0.75f, 0f, Tween.EaseIn); yield return(new WaitForSeconds(learnedDucking ? 0.7f : 0.5f)); if (!PlayerController.Instance.Ducking) { Survived = false; PlayerController.Instance.Anim.SetTrigger("impale"); PlayerController.Instance.Die(); yield return(new WaitForEndOfFrame()); fallingSpear.gameObject.SetActive(false); yield return(new WaitForSeconds(0.3f)); yield break; } fallingSpear.GetComponent <SpriteRenderer>().sortingOrder = 5; yield return(new WaitForSeconds(learnedDucking ? 0.5f : 0.25f)); if (!learnedDucking) { Tween.Position(controlsHint.transform, controlsHint.transform.position + Vector3.down * 2f, 1f, 0f, Tween.EaseInOut); TutorialProgress.LearnMechanic(TutorialProgress.Mechanic.Ducking); } //embed in ground animation }
protected override IEnumerator EventSequence() { if (!TutorialProgress.MechanicIsLearned(TutorialProgress.Mechanic.Throwing) && controlsHint != null) { Tween.Stop(controlsHint.GetInstanceID()); controlsHint.transform.localPosition = new Vector3(0f, -6.31f, 0f); Tween.Position(controlsHint.transform, controlsHint.transform.position + Vector3.up * 2f, 0.25f, 0f, Tween.EaseInOut); } screamSound = AudioController.Instance.PlaySound2D("enemy_scream").gameObject; yield return(new WaitForSeconds(0.2f)); signal.SetActive(true); signal.transform.position = signalStart.position; Tween.Position(signal.transform, signalStart.position + new Vector3(-2f, 5f), 0.5f, 0f, Tween.EaseInOut); yield return(new WaitForSeconds(0.5f)); signal.SetActive(false); fallingEnemy.gameObject.SetActive(true); Tween.Position(fallingEnemy, endMarker.position, fallDuration, 0f, Tween.EaseIn); float timer = 0f; while (timer < durationUntilImpact && !PlayerController.Instance.Throwing) { timer += Time.deltaTime; yield return(new WaitForEndOfFrame()); } if (PlayerController.Instance.Throwing) { if (controlsHint != null) { Tween.Position(controlsHint.transform, controlsHint.transform.position + Vector3.up * -3f, 0.25f, 0f, Tween.EaseInOut); } TutorialProgress.LearnMechanic(TutorialProgress.Mechanic.Throwing); yield return(new WaitForSeconds((durationUntilImpact * durationUntilImpact) - timer)); Tween.Stop(fallingEnemy.GetInstanceID()); fallingEnemyAnim.SetTrigger("die"); Destroy(screamSound); AudioController.Instance.PlaySound2D("enemy_scream_short"); AudioController.Instance.PlaySound2D("misc_crunch_1", pitch: new AudioParams.Pitch(AudioParams.Pitch.Variation.Small)); CameraEffects.Instance.Shake(); sortingGroup.sortingOrder = 10; Vector2 landingPos = new Vector2(fallingEnemy.position.x, corpseMarker.position.y); Tween.Position(fallingEnemy.transform, landingPos, 0.15f, 0.1f, Tween.EaseIn); yield return(new WaitForSeconds(0.5f)); } else { enemyDagger.GetComponent <SpriteRenderer>().enabled = false; Survived = false; PlayerController.Instance.Anim.SetTrigger("knife"); PlayerController.Instance.Die(); yield return(new WaitForSeconds(0.3f)); if (controlsHint != null) { Tween.Position(controlsHint.transform, controlsHint.transform.position + Vector3.up * -3f, 0.25f, 0f, Tween.EaseInOut); } } }