小怪受击身体变红特效代码

private bool ColorIng = false;

private SkinnedMeshRenderer primaryRenderer;

    IEnumerator HitColor()

    {

        if (ColorIng)

            yield break;

        ColorIng = true;

        Color t = primaryRenderer.material.color;

        primaryRenderer.material.color = Color.red;

        

        yield return new WaitForSeconds(0.2f);

        primaryRenderer.material.color = t;

        ColorIng = false;

    }

 

你可能感兴趣的:(代码)