Esempio n. 1
0
		public void StarBurst(Vector2 pos, float particleSpeed)
		{
			if (_audioManager)
				_audioManager.PlayAudioClip("fireworkBurst");
			
			GameObject burstGameObject = Instantiate(burstPrefabs[0]) as GameObject;
			burstGameObject.transform.localPosition = pos;
			burstGameObject.transform.SetParent(transform);

			float radius = 70f;
			float speed = particleSpeed;	//1500f;	//500f;
			float gravity = -1550f;
			int numParticles = 12;

			for(int i=0; i<numParticles; i++)
			{
				float jSpeed = speed * UnityEngine.Random.Range(0.8f,1.2f);
				float r = i * (Mathf.PI*2 / numParticles);
				Vector2 pPos = new Vector2(pos.x + Mathf.Sin(r) * radius, pos.y + Mathf.Cos(r) * radius);
				Vector2 pVel = new Vector2(Mathf.Sin(r) * jSpeed, Mathf.Cos(r) * jSpeed);
				Vector2 pAcc = new Vector2(0f, gravity);

				GameObject particleGameObject = Instantiate(particlePrefabs[0]) as GameObject;
				FireworkParticle particle = particleGameObject.GetComponent<FireworkParticle>();
				particle.transform.localPosition = pPos;
				particle.transform.SetParent(transform);
				float lifeSpan = 0.5f + UnityEngine.Random.Range(0f,0.5f);
				particle.SetMotion(pVel,pAcc,lifeSpan);
			}
		}
Esempio n. 2
0
 public void ClickedBack()
 {
     if (_audioManager)
     {
         _audioManager.PlayAudioClip("pressedBack");
     }
     Application.LoadLevel("menu");
 }
        IEnumerator ZoomSequence()
        {
            float movement1time = 0.2f;
            float movement2time = 1.0f;
            float movement3time = 0.2f;

            if (_audioManager)
            {
                _audioManager.PlayAudioClip("speedyMessageComesIn");
            }

            Vector2 pos = transform.localPosition;

            originalPos             = pos;
            pos.x                  += 2000f;
            transform.localPosition = pos;
            Movement mov = gameObject.GetComponent <Movement>();

            mov.MoveTo(originalPos, movement1time);
            yield return(new WaitForSeconds(movement1time));

            mov.MoveBy(new Vector2(32f, 0f), movement2time, true);
            if (_audioManager)
            {
                _audioManager.PlayAudioClip("speedyMessageSound");
            }
            yield return(new WaitForSeconds(movement2time));

            if (_audioManager)
            {
                _audioManager.PlayAudioClip("speedyMessageComesIn");
            }
            mov.MoveBy(new Vector2(-2000f, 0f), movement3time);
            yield return(new WaitForSeconds(movement3time));

            if (finishedCallback != null)
            {
                finishedCallback();
            }
            Destroy(gameObject, 0.0f);
        }
Esempio n. 4
0
        private void Update()
        {
            int secondsBefore, secondsAfter;

            // _currentTime is used for the 'internal' clock. It keeps ticking down regardless of the visible state of the timer bar.
//			if (/*!_paused && */_currentTime > 0)
            if (!_internalPaused && _currentTime > 0)
            {
                secondsBefore = (int)_currentTime;
                _currentTime -= Time.deltaTime;
                secondsAfter  = (int)_currentTime;

                if ((_state == TimerBarState.Normal) && _countdownSounds && (secondsBefore != secondsAfter) && (secondsBefore <= 10))
                {
                    if (_audioManager)
                    {
                        _audioManager.PlayAudioClip("timerCountdown");
                    }
                    _fillImage.gameObject.GetComponent <Visibility>().Flash(4, 0.05f, 0.05f, true);
                }

                if (_currentTime < 0)
                {
                    // time has run out
                    SetBarAlpha(0f);
                    _currentTime = 0;
                    if (_state == TimerBarState.Normal && !_paused)
                    {
                        gameController.SendMessage("TimerExpired");
                    }
                }

                if (_state == TimerBarState.Normal && !_paused)
                {
                    _visibleTime = _currentTime;
                    PositionBar();
                }
            }

            // _visibleTime is the length of the timer bar on the screen. It can be reduced quickly during the tot up.
            if (_state == TimerBarState.QuickTotUpReduce)
            {
                if (!_paused && _visibleTime > 0)
                {
                    _visibleTime -= Time.deltaTime * _fastReductionMultiple;
                    PositionBar();
                }
            }
        }
        IEnumerator BombCancellationAnimSequence()
        {
            if (_audioManager)
            {
                _audioManager.PlayAudioClip("bombExtinguishing");
            }

            blockRefresh = true;

            yield return(new WaitForSeconds(0.1f));

            RawImage raw = GetComponent <RawImage>();

            for (int f = 0; f < 5; f++)
            {
                //raw.texture = _bombTexture;
                yield return(new WaitForSeconds(0.05f));

                raw.texture = _bombExtinguishedTexture;
                yield return(new WaitForSeconds(0.05f));
            }

            Color c = Color.cyan;

            c.a = 0f;
            _whiteLayer.GetComponent <RawImage>().color = c;
            _whiteLayer.GetComponent <Visibility>().FadeIn(0.2f);
            blockRefresh = false;
            yield return(new WaitForSeconds(0.2f));

            _whiteLayer.GetComponent <Visibility>().FadeOut(0.5f);

            yield return(new WaitForSeconds(0.1f));

            yield return(new WaitForSeconds(0.8f));
        }
Esempio n. 6
0
        IEnumerator DoubleDownSequence()
        {
            float movement1time = 1.0f;

            if (_audioManager)
            {
                _audioManager.PlayAudioClip("speedyMessageComesIn");
            }

            //gameObject.GetComponent<Visibility>().Flash(100, 0.1f, 0.1f, true);
            yield return(new WaitForSeconds(movement1time));

            if (finishedCallback != null)
            {
                finishedCallback();
            }
            Destroy(gameObject, 0.0f);
        }
        IEnumerator ZoomSequence()
        {
            float fadeInTime  = 0.2f;
            float pauseTime   = 1.0f;
            float fadeOutTime = 0.35f;

            messageText.text = "streak x" + _streakCount;

            //yield return new WaitForSeconds(0.9f);

            int secondaryMessageNum = 0;

            if (_streakCount == _questionManager.GetNumberOfQuestions())
            {
                secondaryMessageNum = 3;
                if (_audioManager)
                {
                    _audioManager.PlayAudioClip("streakPerfectRun");
                }
            }
            else if (_streakCount >= 6)
            {
                secondaryMessageNum = 2;
                if (_audioManager)
                {
                    _audioManager.PlayAudioClip("streakAmazing");
                }
            }
            else if (_streakCount >= 4)
            {
                secondaryMessageNum = 1;
                if (_audioManager)
                {
                    _audioManager.PlayAudioClip("streakExcellent");
                }
            }
            else
            {
                if (_audioManager)
                {
                    _audioManager.PlayAudioClip("streakNormal");
                }
            }



            EnableSpecificSecondaryMessage(secondaryMessageNum);

            foreach (Visibility vis in visibilityComponents)
            {
                vis.Hide();
                vis.FadeIn(0.25f);
            }
            secondaryMessages[secondaryMessageNum].SendMessage("Hide");
            secondaryMessages[secondaryMessageNum].SendMessage("FadeIn", 0.25f);
            Visibility parentVis = secondaryMessages[secondaryMessageNum].transform.parent.gameObject.GetComponent <Visibility>();

            parentVis.SetInitialAlpha(100f / 255);
            parentVis.Hide();
            parentVis.FadeIn(0.25f);

//			float aspectRatio = (float)texture.width / texture.height;
//			pictureAspectRatioFitterUI.aspectRatio = aspectRatio;

            Scaler scaler = gameObject.GetComponent <Scaler>();

            scaler.ScaleBackFrom(0.8f, fadeInTime);

            yield return(new WaitForSeconds(fadeInTime));

            yield return(new WaitForSeconds(pauseTime));

            scaler.ScaleTo(2.0f, fadeOutTime);

            foreach (Visibility vis in visibilityComponents)
            {
                vis.FadeOut(fadeOutTime / 2);
            }
            secondaryMessages[secondaryMessageNum].SendMessage("FadeOut", fadeOutTime / 2);
            parentVis.FadeOut(fadeOutTime / 2);

            yield return(new WaitForSeconds(fadeOutTime));

            if (finishedCallback != null)
            {
                finishedCallback();
            }
            Destroy(gameObject, 0.0f);
        }
 public void ClickedStartquizType2()
 {
     if (_audioManager)
     {
         _audioManager.PlayAudioClip("pressPlay");
     }
     _questionManager.SetSelectedQuizType(QuestionManager.QuizTypes.quizType2);
     Application.LoadLevel("LevelSelect");
 }