Пример #1
0
    private void Melee()
    {
        refAnimator.SetTrigger("Sneeze");

        refAudioManager.PlaySound(inhale.clip, inhale.volume, true);

        Invoke("MeleeSpawn", timeUntilAttack);
    }
Пример #2
0
    private void Pounce()
    {
        pounced = true;

        // start ignoring collision with ground
        Physics2D.IgnoreLayerCollision(gameObject.layer, 8);

        // reactivate gravity
        rb.gravityScale = 1.0f;

        // make the enemy invicible
        refEnemy.immuneToArrows = true;
        refEnemy.immuneToHammer = true;

        // play jump sound
        refAudioManager.PlaySound(pounceSound.clip, pounceSound.volume, 0.5f);

        refAnimator.SetTrigger("Pounce");

        if (facingRight)
        {
            rb.velocity = new Vector2(pounceVector.x * -1, pounceVector.y);

            // play particles
            pouncePartsLeft.Play();
        }
        else
        {
            rb.velocity = new Vector2(pounceVector.x, pounceVector.y);

            // play particles
            pouncePartsRight.Play();
        }
    }
Пример #3
0
    private void Death()
    {
        // drop something from the list of drops
        if (drops.Length != 0)
        {
            refAudioManager.PlaySound(death.clip, death.volume);
            Instantiate(drops[Random.Range(0, drops.Length)], transform.position, Quaternion.identity);
        }

        if (spawnOnDeath != null)
        {
            Instantiate(spawnOnDeath, transform.position, Quaternion.identity);
        }

        Destroy(gameObject);
    }
Пример #4
0
    // tells all objects to panic or stop panicing
    public void Panic(bool state)
    {
        Debug.Log("BROADCAST - setting panic state to " + state);

        fadeAway = state;

        //player.GetComponent<PlayerMovementNew>().Panic(state);

        for (int i = 0; i < enemies.Length; i++)
        {
            enemies [i].GetComponent <Enemy>().Panic(state);
        }

        MusicManager.Panic(state);

        if (state == true)
        {
            FXManager.PlaySound(awaken, 1.0f);
        }

        if (state == false && panicMode == true)
        {
            DestroyAllWebs();
        }

        panicMode = state;
    }
Пример #5
0
    private IEnumerator FireProjectiles()
    {
        // don't shoot if we're dead
        // only shoot if we're in range or the player is above us
        while (refEnemy.isDead == false)
        {
            if (transform.position.y - refPlayer.transform.position.y <= detectionDistance || transform.position.y < refPlayer.transform.position.y)
            {
                // fire the projectile and move it
                GameObject tmp = Instantiate(eggplantPrefab, transform.position, transform.rotation);

                // play a sound
                refAudioManager.PlaySound(fire.clip, fire.volume, true);

                // flip the direction of the projectile depending on the direction you're facing
                if (facingRight == true)
                {
                    tmp.GetComponent <Rigidbody2D>().AddForce(force);
                }
                else
                {
                    tmp.GetComponent <Rigidbody2D>().AddForce(new Vector2(force.x * -1, force.y));
                }
            }

            yield return(new WaitForSeconds(fireRate));
        }
    }
Пример #6
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         // but not that Panic...
         refAudioManager.PlaySound(panic.clip, panic.volume, true);
         refEnemyReaper.Panic();
     }
 }
Пример #7
0
    private void PopOut()
    {
        // change position
        Reposition(new Vector2(0, 0.5f));

        // do animation
        refAnimator.SetTrigger("Shooting");

        // make vulnerable
        refEnemy.immuneToArrows = false;
        refEnemy.immuneToHammer = false;
        refCollider.enabled     = true;

        // play sound
        refAudioManager.PlaySound(soundPopOut.clip, soundPopOut.volume, true);

        Invoke("ActuallyShoot", timeStartup);
    }
Пример #8
0
    private IEnumerator ReaperCry()
    {
        // as long as we're panicking, play the cry sound
        while (isPanicked == true)
        {
            refAudioManager.PlaySound(cry.clip, cry.volume, true);

            yield return(new WaitForSeconds(cryInterval));
        }
    }
Пример #9
0
    private IEnumerator PlayFlightSound()
    {
        while (refEnemy.isDead == false)
        {
            if (isChasing == true)
            {
                refAudioManager.PlaySound(flight.clip, flight.volume, true);
            }

            yield return(new WaitForSeconds(flightSoundInterval));
        }
    }
Пример #10
0
    private void DoRandomEffect()
    {
        int tmp = Random.Range(0, 4);

        switch (tmp)
        {
        case 0:
        {
            goddessText.text        = "The next item you purchase in the\nshop will be half off...";
            refPlayerCollision.sale = 2;
            break;
        }

        case 1:
        {
            goddessText.text = "Health restoration for 10 seconds...";
            refPlayerCollision.SetConstantHealthRegen(true, 10);
            break;
        }

        case 2:
        {
            goddessText.text = "I've sent the Orne down " + wardMeters + "m\nfor you, Pit...";
            EnemyOrne tmpOrne = GameObject.FindObjectOfType <EnemyOrne>();
            tmpOrne.SendBack(wardMeters);
            break;
        }

        case 3:
        {
            goddessText.text = "Komaytos are attacking!\nOnly your hammer can defeat them!";
            Instantiate(komaytoPrefab, Vector2.zero, transform.rotation);
            refAudioManager.PlaySound(komaytoSound.clip, komaytoSound.volume);
            break;
        }

        default:
        {
            goddessText.text = "Sorry Pit, the goddess screwed up her switch statement somehow.";
            break;
        }
        }

        Invoke("FadeOut", destroyAfterTime - 1.5f);
        Invoke("Dest", destroyAfterTime);
    }
Пример #11
0
    void Update()
    {
        if (currentHealth <= 0 && isDead == false)
        {
            isDead = true;
            refAudioManager.PlaySound(death.clip, death.volume, 1.5f);
            refPlayerShoot.hasCenturion = false;
        }

        if (isDead == false)
        {
            FlipSprite();
            UpdatePosition();
            Shooting();
        }
        else
        {
            sr.flipY    = true;
            rb.velocity = Vector2.down * arrowProjectileSpeed;
            Invoke("Dest", 2.0f);
        }
    }
Пример #12
0
 public void PlayJump()
 {
     refAudioManager.PlaySound(jump.clip, jump.volume, true);
 }
Пример #13
0
 public void PlayCollectAll()
 {
     refAudioManager.PlaySound(collectAll, false);
 }