public void AnimationBombExplode(BombExplodeCallback callback, float animationTime = 0f) { state = JigsawSquareStates.Exploding; timeAtStartOfAnim = Time.realtimeSinceStartup - animationTime; _bombExplodeCallback = callback; bombExplodeCoroutine = BombExplodeAnimSequence(animationTime); StartCoroutine(bombExplodeCoroutine); }
public void StopExplosion() { Debug.Log("StopExplosion"); StopCoroutine(bombExplodeCoroutine); GetComponent <ShakeImage>().SetShakeMagnitude(0f); _whiteLayer.GetComponent <Visibility>().FadeOut(0.001f); GetComponent <ExpandImage>().StartZoom(1f, 1f, 0.01f); state = JigsawSquareStates.Normal; blockRefresh = false; }
IEnumerator BombExplodeAnimSequence(float currentTime) { if (_audioManager && currentTime == 0f) { _audioManager.PlayAudioClip("jigsawBombSwelling"); } blockRefresh = true; yield return(StartCoroutine(DelayIfNecessary(0.1f))); GetComponent <ShakeImage>().SetShakeMagnitude(0f); GetComponent <ExpandImage>().StartZoom(1.0f, 0.1f, 1.5f, 2.1f, GetAnimationTime()); //GetComponent<ExpandImage>().StartZoom(1f,1.5f,2.0f); Color c = Color.red; c.a = 0f; _whiteLayer.GetComponent <RawImage>().color = c; //_whiteLayer.GetComponent<Visibility>().FadeIn (4.0f); _whiteLayer.GetComponent <Visibility>().FadeIn(0.1f, 4.1f, GetAnimationTime()); yield return(StartCoroutine(DelayIfNecessary(1.1f))); GetComponent <ShakeImage>().SetShakeMagnitude(0.0001f); yield return(StartCoroutine(DelayIfNecessary(2.0f))); blockRefresh = false; if (_audioManager) { _audioManager.PlayAudioClip("jigsawBombExplosion"); } ExplosionParticles(); _bombExplodeCallback(); Debug.Log("After explosion"); yield return(StartCoroutine(DelayIfNecessary(2.1f))); state = JigsawSquareStates.Normal; }