Ejemplo n.º 1
0
    GameBlock GenerateBlock(int x, int y, bool isDeactivated = false)
    {
        blockId = Mathf.Clamp(Random.Range(0, BlockSprites.Length), 0, BlockSprites.Length - 1);
        float random = Random.value;

        //if (random >= 0.75f)
        if (random >= 0.99f)
        {
            blockPowerup  = GameBlock.Powerup.BoardClear;
            powerupSprite = BoardClearPowerup;
        }
        //else if (random >= 0.5f)
        else if (random >= 0.95f)
        {
            blockPowerup  = GameBlock.Powerup.TimeStop;
            powerupSprite = TimeStopPowerup;
        }
        else
        {
            blockPowerup  = null;
            powerupSprite = null;
        }

        return(GameBlock.Spawn(BlockSprites[blockId], powerupSprite, GetLocalPosition(x, y), blockId, blockPowerup, _t, x, y, isDeactivated));
    }