Exemple #1
0
    IEnumerator Attack()
    {
        isAttacking = true;
        float timeTaken = 0;

        foreach (ParticleSystem ps in OozeParticles)
        {
            ps.Play();
        }

        attackArea.ActivateAttack(oozeAttack);

        while (timeTaken < TimeToAttack && curState != BomberState.Die)
        {
            timeTaken += Time.deltaTime;

            transform.position += transform.forward * AttackSpeed * Time.deltaTime;

            yield return(null);
        }

        attackArea.EndAttack();

        isAttacking = false;
        curState    = curState == BomberState.Die ? BomberState.Die : BomberState.Patrol;
        yield return(null);
    }
    IEnumerator ActivatingAttack()
    {
        isActivatingAttack = true;
        yield return(new WaitForSeconds(.25f));

        attackArea.ActivateAttack(attack);
        yield return(new WaitForSeconds(.33f));

        attackArea.EndAttack();
        isActivatingAttack = false;
    }
Exemple #3
0
    IEnumerator Attack()
    {
        isAttacking = true;
        float      timeTaken = 0;
        Quaternion init      = new Quaternion(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w);

        attackArea.ActivateAttack(diveAttack);
        transform.LookAt(player);

        while (timeTaken < TimeToAttack && curState != FlyerState.Die)
        {
            timeTaken += Time.deltaTime;

            transform.position += transform.forward * AttackSpeed * Time.deltaTime;

            yield return(null);
        }

        attackArea.EndAttack();

        timeTaken = 0;

        while (timeTaken < TimeToAttack * 2 && curState != FlyerState.Die)
        {
            timeTaken += Time.deltaTime;

            transform.position -= transform.forward * AttackSpeed * .5f * Time.deltaTime;

            yield return(null);
        }

        transform.rotation = init;

        isAttacking = false;
        curState    = curState == FlyerState.Die ? FlyerState.Die : FlyerState.Patrol;
        yield return(null);
    }
Exemple #4
0
 void EndAttack()
 {
     attackArea.EndAttack();
 }