I was just fighting with the Block Breaker scripts, trying to get the score to change depending on the block type (1, 2, or 3 hit). Came across this pretty easy solution that multiplies the points by the number of hits a block can take.
In Block.cs I made maxHits a public int and assigned it at Start, then added that int to AddToScore in DestroyBlock.
int maxHits;
private void Start()
{
level = FindObjectOfType<Level>(); //sets level to current instance
gamestatus = FindObjectOfType<GameSession>(); //sets gamestatus to current instance
maxHits = hitSprites.Length + 1; //maximum hits a block can take
}
private void DestroyBlock()
{
gamestatus.AddToScore(maxHits); //adds score after being hit
...
...
}
Then GameSession.cs I overloaded AddToScore to accept an int-
public void AddToScore(int blockType)
{
currentScore += pointsPerBlockDestroyed * blockType;
scoreText.text = currentScore.ToString();
}
Works great so far. I’m still very much a novice so would love to know if any of you figured out any better methods!