Skip to content

Commit

Permalink
Add flash mechanic
Browse files Browse the repository at this point in the history
  • Loading branch information
Freezor committed Nov 21, 2021
1 parent f35d720 commit 44325f7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Breakout2021/Assets/Scripts/World/Targets/TargetElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class TargetElement : MonoBehaviour
private int _numberOfHits;

[SerializeField] public FlashRenderer flashScript;
[SerializeField] public Color flashColor = Color.white;
[SerializeField] public Color[] flashColors;

private void Start()
{
Expand All @@ -25,7 +25,15 @@ void OnCollisionEnter2D(Collision2D collisionInfo)

if (flashScript != null)
{
flashScript.Flash(flashColor);
// TODO: flash for amount of hits
if (flashColors != null)
{
flashScript.Flash(flashColors(_numberOfHits));
}
else
{
flashScript.Flash(Color.white);
}
}

_numberOfHits++;
Expand Down

0 comments on commit 44325f7

Please sign in to comment.