void Respawn()
    {
        // if still running
        if (particlesDestroy)
        {
            Debug.Log("stop particle");
            particlesDestroy.Clear();
            particlesDestroy.Stop();
        }

        // Reposition and re-enable
        transform.position = RespawnPosition;

        rb2d.velocity        = Vector2.zero;
        rb2d.angularVelocity = 0;
        rb2d.MoveRotation(0);
        rb2d.drag = savedDrag;

        //rb2d.bodyType = RigidbodyType2D.Dynamic;
        collider2d.enabled = true;

        // Fade in
        if (fadeSprite)
        {
            fadeSprite.ReverseFade();
        }

        // particles
        if (particlesSpawn)
        {
            particlesSpawn.Play();
        }
    }
    IEnumerator ToggleBetween()
    {
        while (true)
        {
            fade.StartFade();
            scaling.StartScaling();

            yield return(new WaitForSeconds(delayBetweenToggle));

            fade.ReverseFade();
            scaling.ReverseScaling();

            yield return(new WaitForSeconds(delayBetweenToggle));
        }
    }
Пример #3
0
 public void DestroyOrb()
 {
     breakDown = true;
     fadeSprite.ReverseFade();
     scaleGameObject.ReverseScaling();
 }