Ejemplo n.º 1
0
 IEnumerator MisfireEffect()
 {
     // I had an interesting effect when playing the "click" sound
     // It was based on it playing many times rapidly
     // Play it in the background so nothing stutters
     for (int i = 0; i < 20; i++)
     {
         audioController.PlayAudio(GC.AudioController.Sources.Misfire);
         yield return(new WaitForSeconds(Time.fixedDeltaTime / 2));
     }
 }
Ejemplo n.º 2
0
        // Use this for initialization
        void Start()
        {
            audioController = FindObjectOfType <GC.AudioController>();
            LevelController = FindObjectOfType <GC.LevelController>();
            rb = GetComponent <Rigidbody2D>();

            // Enable engine rumble
            audioController.ToggleAudioContinuous(GC.AudioController.Sources.Movement, true);
            audioController.PlayAudio(GC.AudioController.Sources.Movement);
        }
Ejemplo n.º 3
0
        // Update is called once per frame
        void Update()
        {
            // Randomly pick the next time it will fire, fire at that time
            if (Time.time - previousSpawnTime > nextRandomTime)
            {
                //Debug.Log("Spawning");
                previousSpawnTime = Time.time;
                nextRandomTime    = Random.Range(spawnrate - randomSpawnRange, spawnrate + randomSpawnRange);
                //Transform t = ChooseSpawnTransform();
                GameObject bullet = Instantiate(bulletPrefab, GameObject.Find("InstantiateContainer").transform);//, t.position, t.rotation);
                ChooseSpawnTransform(bullet.transform);

                Vector2 shipVelocity = GetComponent <Rigidbody2D>().velocity;

                // Give the bullet the ship's velocity, and let the bullet handle its own forward force from there
                bullet.GetComponent <Rigidbody2D>().velocity = shipVelocity;
                //bullet.GetComponent<Rigidbody2D>().AddForce(bulletSpeed);

                audioController.PlayAudio(GC.AudioController.Sources.EnemyShooter);
            }
        }