示例#1
0
    public void activateLever()
    {
        if (!activated)
        {
            activated = true;
            anim.Play("Activate");
            foreach (GameObject obj in objectsToActivate)
            {
                obj.SetActive(true);
            }
            foreach (GameObject obj in objectsToDestroy)
            {
                Destroy(obj);
            }

            MusicMGR.PlayAudioClip(soundToPlay, Amount, Timer, timeAdded, useFilter);

            if (spawnEnemies)
            {
                for (int i = 0; i < amountEnemies; i++)
                {
                    SpawnEnemy();
                }
            }
        }
    }
示例#2
0
    private void FireBullet()
    {
        if (fireSound)
        {
            MusicMGR.PlayAudioClip(fireSound, 0, 0, 0, false);
        }
        fireRate     = fireRateSave;
        currentAmmo -= 1;
        GameObject newBullet = Instantiate(bullet, barrel.transform.position, barrel.transform.rotation);

        newBullet.GetComponent <Rigidbody>().AddForce(newBullet.transform.forward * bulletFireSpeed);
        newBullet.GetComponent <Bullet>().SetStats(damage, destroyBulletOnHit);
        Destroy(newBullet, 3);
    }