Exemple #1
0
        private IEnumerator spawnAsteroid()
        {
            // get random screen vertical point to spawn asteroid and exclamation
            float   screenVerticalSpawnPercentage = Random.Range(m_LowerScreenBound, m_UpperScreenBound);
            Vector3 spawnPos = Utility.ScreenUtilities.GetWSofSSPosition(1.0f, screenVerticalSpawnPercentage);

            spawnPos.z = -80.0f;

            // spawn exclamation
            Blink exclamationInstance = Instantiate(
                m_ExclamationPrefab,
                spawnPos,
                Quaternion.identity,
                this.transform);

            // make sure blinking increases speed
            StartCoroutine(exclamationInstance.ChangeBlinkSpeed(exclamationInstance, m_ExclamationTime / 1.5f));

            // wait for certain time before spawning asteroid
            yield return(new WaitForSeconds(m_ExclamationTime));

            // destroy exclamation
            Destroy(exclamationInstance.gameObject);

            // spawn asteroid after time
            Asteroid asteroidInstance = Instantiate(m_AsteroidPrefab,
                                                    spawnPos,
                                                    Quaternion.identity);

            asteroidInstance.AddForce(m_InitialForce * 1000.0f);
        }
Exemple #2
0
        private IEnumerator charge()
        {
            StartCoroutine(m_LaserBlinkInstance.ChangeBlinkSpeed(m_LaserBlinkInstance, m_LaserChargeTime / 1.5f));

            yield return(new WaitForSeconds(m_LaserChargeTime));

            // destroy blinking laser icon
            Destroy(m_LaserBlinkInstance.gameObject);

            shootLaser();
        }