public void advanceBlockState() { switch (blockState) { case Level.SPRITE.HIDDEN: { blockState = Level.SPRITE.QUESTION; spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.QUESTION]; } break; case Level.SPRITE.QUESTION: { blockState = Level.SPRITE.FLAG; spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.FLAG]; } break; case Level.SPRITE.FLAG: { blockState = Level.SPRITE.HIDDEN; spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.HIDDEN]; } break; } }
// Use this for initialization void Start() { spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); isPlayable = true; mineCount = 0; hasMine = false; blockState = Level.SPRITE.HIDDEN; }
//reveal mines count public void revealMineCount() { if (mineCount == 0) { spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.REVEALED]; } else if (!hasMine) { Level.SPRITE spriteType = (Level.SPRITE)mineCount; spriteRenderer.sprite = Level.instance.sprites[spriteType]; } }
private void showLoseSprite() { if (hasMine) { spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.MINELOST]; } else if (mineCount == 0) { spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.REVEALEDLOST]; } else { Level.SPRITE spriteType = (Level.SPRITE)(40 + mineCount); spriteRenderer.sprite = Level.instance.sprites[spriteType]; } }
private void showPlaySprite() { if (hasMine) { spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.MINEWON]; } else if (mineCount == 0) { spriteRenderer.sprite = Level.instance.sprites[Level.SPRITE.REVEALEDPLAY]; } else { Level.SPRITE spriteType = (Level.SPRITE)mineCount; spriteRenderer.sprite = Level.instance.sprites[spriteType]; } }