Exemplo n.º 1
0
    private IEnumerator _reload(float time)
    {
        CirclePartState tmpState = state;

        state = CirclePartState.Reload;

        StopCoroutine(reloadCoroutine);

        hide();
        if (time == 0f)
        {
            hidePs.Play();
        }
        else
        {
            circle.gameController.audioController.brokenPlatform();
            DestructiveEntity entity = Instantiate(brokenCirclePart, transform.position, Quaternion.Euler(0f, 0f, Range(0f, 360f)));
            entity.brokeDown(spriteRenderer.color);
        }

        yield return(new WaitUntil(() => collisionDelay == false));

        if (time != 0f)
        {
            yield return(new WaitForSeconds(Range(time / 2f, time)));
        }

        state = tmpState;

        show();

        collisionCount = 0;
        setColor(circle.randomColor());
        if (state == CirclePartState.Spike)
        {
            spriteRenderer.sprite = spikeSprites[Range(0, spikeSprites.Length)];
        }
        else
        {
            state = CirclePartState.Default;
            spriteRenderer.sprite = defaultSprite;
        }
    }
Exemplo n.º 2
0
    private void die(DieType type)
    {
        isDead = true;

        cc2d.enabled = false;
        sprite.gameObject.SetActive(false);

        if (type == DieType.Spike)
        {
            DestructiveEntity bp = Instantiate(brokenPlayer, transform.position, Quaternion.Euler(0f, 0f, Range(0f, 360f)));
            bp.brokeDown(sprite.color);

            ParticleSystem.MainModule main = diePs.main;
            main.startColor = sprite.color;
            diePs.Play();
        }

        died?.Invoke();
    }