public static IEnumerator StartHitstun() { HitStunEnabled = true; yield return(CustomTimer.Timer(.075f)); //Hitstun time HitStunEnabled = false; }
//Set a delay before warping to check line of sight. private IEnumerator TimeBeforeWarping() { yield return(CustomTimer.Timer(.75f)); TransitionToState(PetState.WarpToPlayer); TimeBetweenWarpsCoroutine = StartCoroutine(DelayBetweenWarping()); }
private IEnumerator Invincibility() { Invincible = true; yield return(CustomTimer.Timer(2f)); Invincible = false; }
//Delay before the player can click to swing again. private IEnumerator DelayBetweenClick(float time) { //Debug.Log("Player can click."); yield return(CustomTimer.Timer(time)); DelayHasPassed = true; }
private IEnumerator SetKnockedState() { currentState = EnemyState.Knocked; yield return(CustomTimer.Timer(.25f)); currentState = EnemyState.Idle; }
//Sets a delay to attack even if the pet isn't outside the reposition radius private IEnumerator AttackEnemyDelay() { yield return(CustomTimer.Timer(.75f)); //Debug.Log("Attacking anyways"); AttackCoroutine = StartCoroutine(AttackEnemy()); }
//private IEnumerator AttackDelayTime() //{ // float rand = UnityEngine.Random.Range(.35f, 1.35f); // yield return CustomTimer.Timer(rand); // _canAttack = true; // canStartAttackDelayTime = true; //} //Attack time before going back to followTarget. private IEnumerator AttackTime(float time) { yield return(CustomTimer.Timer(time)); _canReposition = true; CurrentAttackState = RaccoonAttackState.FollowTarget; }
private IEnumerator ForceDeviationChange() { yield return(CustomTimer.Timer(.5f)); _forcingMovementTowardsPlayer = false; _canChangeDeviation = true; }
//Random time between each reposition. private IEnumerator RepositionTime(float range1, float range2) { float rand = UnityEngine.Random.Range(range1, range2); yield return(CustomTimer.Timer(rand)); _canReposition = true; }
//Time between swings private IEnumerator SwingTimer(float time) { yield return(CustomTimer.Timer(time)); CanSwing = true; controller.TransitionToState(CharacterState.Default); DelayBetweenComboResetCoroutine = StartCoroutine(DelayBetweenComboReset(.25f)); }
//Stop this coroutine if knocked. IEnumerator TargetPlayerDelay() { yield return(CustomTimer.Timer(1f)); currentState = EnemyState.Random; lastdir = -(target - transform.position).normalized; yield return(null); }
private IEnumerator CanShootDelay() { canShoot = false; yield return(CustomTimer.Timer(.5f)); canShoot = true; canStartBowHold = true; }
//Transition to default state while in midair after x amount of time. //private IEnumerator TimeBeforeFallingStateCoroutine() //{ // yield return CustomTimer.Timer(.1f); // TransitionToState(RaccoonState.Default); //} //Greyed out for now until we can tell the raccoon to go back to its last state after falling. //Reaction time to detect something. private IEnumerator DetectionReactionTime() { float reactionTime = .35f; yield return(CustomTimer.Timer(reactionTime)); TransitionToState(RaccoonState.Alerted); _canStartReactionTime = true; //Reset }
//Hitstun coroutine public IEnumerator HitstunCo() { //PlayerState lastState = currentState; SetState(PlayerState.Hitstun, true); yield return(CustomTimer.Timer(.075f)); SetState(PlayerState.Hitstun, false); Debug.Log("Hitstun ended"); }
IEnumerator TypeSentenceAnim(string sentence) { dialogueText.text = ""; foreach (char letter in sentence.ToCharArray()) { dialogueText.text += letter; yield return(CustomTimer.Timer(.015f)); } }
//Hitstun coroutine public IEnumerator HitstunCo() { PetStatev2 lastState = currentState; currentState = PetStatev2.Hitstun; yield return(CustomTimer.Timer(.075f)); currentState = lastState; }
//When a path can't be created to the enemy... private IEnumerator CantReachEnemyDelay() { CanReachEnemy = false; currentState = PetStatev2.Wait; //Debug.Log("Entered wait state"); yield return(CustomTimer.Timer(.75f)); currentState = PetStatev2.Idle; }
private IEnumerator BowHoldCheck() { phase = WeaponPhase.Phase1; yield return(CustomTimer.Timer(.3f)); phase = WeaponPhase.Phase2; yield return(CustomTimer.Timer(.3f)); phase = WeaponPhase.Phase3; }
//IEnumerator DelayFollow() //{ // CanTarget = false; // yield return new WaitForSeconds(1f); // CanTarget = true; // yield return new WaitForSeconds(1f); // CanDoCoroutine = true; //} IEnumerator DelayFollow() { CanTarget = false; yield return(CustomTimer.Timer(1f)); CanTarget = true; yield return(CustomTimer.Timer(1f)); CanDoCoroutine = true; }
//Hitstun coroutine public IEnumerator HitstunCo() { PlayerState lastState = currentState; currentState = PlayerState.Hitstun; yield return(CustomTimer.Timer(.075f)); currentState = lastState; Debug.Log("Hitstun ended"); }
//When a path can't be created to the enemy... private IEnumerator CantReachEnemyDelay() { CanReachEnemy = false; CurrentState = PetState.Wait; Debug.Log("Entered wait state"); CanCheckDist = false; yield return(CustomTimer.Timer(.75f)); CanCheckDist = true; }
//Transition to FollowTarget after a sword swing and set an attack delay. private IEnumerator SwordSwingTime(float seconds) { yield return(CustomTimer.Timer(seconds)); _attackDelay = true; TransitionToState(RaccoonState.FollowTarget); yield return(CustomTimer.Timer(2f)); _canSetSwordAttack = true; _attackDelay = false; }
//Sword swing timing private IEnumerator SwordSwingTiming() { CanDelayForCombo = true; Debug.Log("Set to attack state"); player.SetState(PlayerState.Attack, true); ClickCoroutine = StartCoroutine(MouseClickDelay()); yield return(CustomTimer.Timer(SwingTime)); if (ComboPhase == 2) { SwordSwing(); } else { CanSwing = true; } if (SwingNumber >= MaxSwingNumber && CanDelayForCombo) { CanDelayForCombo = false; DelayForClickCombo = StartCoroutine(DelayForNextCombo()); } if (SwingNumber < MaxSwingNumber) { yield return(CustomTimer.Timer(.12f)); AnimatorSwingNumber = 0; player.SetState(PlayerState.Attack, false); yield return(CustomTimer.Timer(.15f)); ResetSwordAttack(); } else { yield return(CustomTimer.Timer(.2f)); AnimatorSwingNumber = 0; player.SetState(PlayerState.Attack, false); yield return(CustomTimer.Timer(.2f)); if (ComboPhase == 4) { ComboPhase = 0; SwingNumber = 0; SwordSwing(); } else { ResetSwordAttack(); } } }
IEnumerator ThrowRock() { yield return(CustomTimer.Timer(.5f)); projectileType.GetComponent <Projectile>().target = target; GameObject rock = Instantiate(projectileType, gameObject.transform.position, Quaternion.identity); yield return(CustomTimer.Timer(2f)); currentState = EnemyState.Idle; CanThrow = true; }
//Sword swing timing private IEnumerator SwordSwingTiming() { CanDelayForCombo = true; controller.TransitionToState(CharacterState.SwordAttack); ClickCoroutine = StartCoroutine(MouseClickDelay()); yield return(CustomTimer.Timer(SwingTime)); if (ComboPhase == 2) { SwordSwing(); } else { CanSwing.initialBool = true; } if (SwingNumber >= MaxSwingNumber && CanDelayForCombo) { CanDelayForCombo = false; DelayForClickCombo = StartCoroutine(DelayForNextCombo()); } if (SwingNumber < MaxSwingNumber) { yield return(CustomTimer.Timer(.12f)); AnimatorSwingNumber = 0; controller.TransitionToState(CharacterState.Default); yield return(CustomTimer.Timer(.15f)); ResetSwordAttack(); } else { yield return(CustomTimer.Timer(.2f)); AnimatorSwingNumber = 0; controller.TransitionToState(CharacterState.Default); yield return(CustomTimer.Timer(.2f)); if (ComboPhase == 4) { ComboPhase = 0; SwingNumber = 0; SwordSwing(); } else { ResetSwordAttack(); } } }
// COROUTINES private IEnumerator SwordMovementCoroutine(float time) //Temp { float timeStart = time * .35f; float timeEnd = timeStart - time; CurrentSwordAttackState = SwordAttackState.SwingStart; //Start swing movement yield return(CustomTimer.Timer(timeStart)); CurrentSwordAttackState = SwordAttackState.SwingEnd; //End swing movement yield return(CustomTimer.Timer(timeEnd)); //canSwing.initialBool = true; //TransitionToState(CharacterState.Default); }
//Rock throw timing private IEnumerator RockThrowTime() { float rand = UnityEngine.Random.Range(1f, 2.5f); yield return(CustomTimer.Timer(rand)); Debug.Log("Throwing a rock."); CurrentAttackState = RaccoonAttackState.RockAttack; yield return(CustomTimer.Timer(2.5f)); CurrentAttackState = RaccoonAttackState.FollowTarget; canThrowRock = true; }
//Set the time between SwingStart and SwingEnd in a sword swing. private IEnumerator SwordMovement(float time) //Temp { yield return(CustomTimer.Timer(.2f)); float timeStart = time * .35f; float timeEnd = timeStart - time; CurrentSwordAttackState = SwordAttackState.SwingStart; //Start swing movement yield return(CustomTimer.Timer(timeStart)); CurrentSwordAttackState = SwordAttackState.SwingEnd; //End swing movement yield return(CustomTimer.Timer(timeEnd)); }
private IEnumerator JumpAtTarget() { Debug.Log("Jump coroutine"); //Animation for winding up attack JumpPosition = (transform.position - target).normalized * -1; yield return(CustomTimer.Timer(.5f)); CanAttack = false; JellyAnim.Attacking = true; //Jump anim yield return(CustomTimer.Timer(.5f)); currentState = EnemyState.Idle; JellyAnim.Attacking = false; //Idle anim yield return(CustomTimer.Timer(1f)); ResetJump(); }
private IEnumerator AttackEnemy() { yield return(CustomTimer.Timer(.3f)); //Leap forward PetAnim.SetAttack(true); //Temp anim difference = enemyPos.initialPos - transform.position; Attacking = true; Jumping = true; yield return(CustomTimer.Timer(.5f)); //Leap back PetAnim.SetAttack(false); //Temp anim JumpMomentum = 0; JumpMomentumScale = 0; Jumping = false; yield return(CustomTimer.Timer(1f)); ResetAttack(); }