Exemplo n.º 1
0
    public static IEnumerator StartHitstun()
    {
        HitStunEnabled = true;
        yield return(CustomTimer.Timer(.075f));        //Hitstun time

        HitStunEnabled = false;
    }
Exemplo n.º 2
0
        //Set a delay before warping to check line of sight.
        private IEnumerator TimeBeforeWarping()
        {
            yield return(CustomTimer.Timer(.75f));

            TransitionToState(PetState.WarpToPlayer);
            TimeBetweenWarpsCoroutine = StartCoroutine(DelayBetweenWarping());
        }
Exemplo n.º 3
0
    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;
    }
Exemplo n.º 5
0
    private IEnumerator SetKnockedState()
    {
        currentState = EnemyState.Knocked;
        yield return(CustomTimer.Timer(.25f));

        currentState = EnemyState.Idle;
    }
Exemplo n.º 6
0
    //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());
    }
Exemplo n.º 7
0
        //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;
        }
Exemplo n.º 8
0
        private IEnumerator ForceDeviationChange()
        {
            yield return(CustomTimer.Timer(.5f));

            _forcingMovementTowardsPlayer = false;
            _canChangeDeviation           = true;
        }
Exemplo n.º 9
0
        //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));
    }
Exemplo n.º 11
0
    //Stop this coroutine if knocked.
    IEnumerator TargetPlayerDelay()
    {
        yield return(CustomTimer.Timer(1f));

        currentState = EnemyState.Random;
        lastdir      = -(target - transform.position).normalized;
        yield return(null);
    }
Exemplo n.º 12
0
    private IEnumerator CanShootDelay()
    {
        canShoot = false;
        yield return(CustomTimer.Timer(.5f));

        canShoot        = true;
        canStartBowHold = true;
    }
Exemplo n.º 13
0
        //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
        }
Exemplo n.º 14
0
    //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");
    }
Exemplo n.º 15
0
 IEnumerator TypeSentenceAnim(string sentence)
 {
     dialogueText.text = "";
     foreach (char letter in sentence.ToCharArray())
     {
         dialogueText.text += letter;
         yield return(CustomTimer.Timer(.015f));
     }
 }
Exemplo n.º 16
0
    //Hitstun coroutine
    public IEnumerator HitstunCo()
    {
        PetStatev2 lastState = currentState;

        currentState = PetStatev2.Hitstun;
        yield return(CustomTimer.Timer(.075f));

        currentState = lastState;
    }
Exemplo n.º 17
0
    //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;
    }
Exemplo n.º 18
0
    private IEnumerator BowHoldCheck()
    {
        phase = WeaponPhase.Phase1;
        yield return(CustomTimer.Timer(.3f));

        phase = WeaponPhase.Phase2;
        yield return(CustomTimer.Timer(.3f));

        phase = WeaponPhase.Phase3;
    }
Exemplo n.º 19
0
    //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;
    }
Exemplo n.º 20
0
    //Hitstun coroutine
    public IEnumerator HitstunCo()
    {
        PlayerState lastState = currentState;

        currentState = PlayerState.Hitstun;
        yield return(CustomTimer.Timer(.075f));

        currentState = lastState;
        Debug.Log("Hitstun ended");
    }
Exemplo n.º 21
0
    //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;
    }
Exemplo n.º 22
0
        //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;
        }
Exemplo n.º 23
0
    //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();
            }
        }
    }
Exemplo n.º 24
0
    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;
    }
Exemplo n.º 25
0
    //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);
        }
Exemplo n.º 27
0
        //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;
        }
Exemplo n.º 28
0
        //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));
        }
Exemplo n.º 29
0
    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();
    }
Exemplo n.º 30
0
    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();
    }