Flash Sprite Sillyness

Just a variation

    public IEnumerator FlashRoutine()
    {
        int numFlashes = 3;

        for (int i = 0; i < numFlashes; i++)
        {
            _spriteRenderer.material = _whiteFlashMaterial;
            yield return new WaitForSeconds(_restoreDefaultMaterialTime);
            _spriteRenderer.material = _redFlashMaterial;
            yield return new WaitForSeconds(_restoreDefaultMaterialTime);
            _spriteRenderer.material = _defaultMaterial;
            yield return new WaitForSeconds(_restoreDefaultMaterialTime);
        }
    }

Privacy & Terms