Exemple #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();
                }
            }
        }
    }
 private void Start()
 {
     musicInstance = this;
     DontDestroyOnLoad(transform.gameObject);
     if (instance == null)
     {
         instance = transform.gameObject;
     }
     else
     {
         Destroy(transform.gameObject);
     }
 }
Exemple #3
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);
    }
Exemple #4
0
 private void Start()
 {
     renderer     = GetComponent <MeshRenderer>();
     idleMaterial = renderer.material;
     MusicMGR.FindFilter();
     rb         = GetComponent <Rigidbody>();
     layer_mask = LayerMask.GetMask("Ground", "Enemy");
     if (ES3.KeyExists("weaponIndex"))
     {
         int index = ES3.Load <int>("weaponIndex");
         setWeapon(index, null);
     }
     else
     {
         activeWeapon = pistol;
     }
 }