I have this reward logic in my reward , my goal is to build a library which I can keep reuse later , however by this following method I can't
class RewardSystem
{
float m_timer;
void Update()
{
m_timer -= time.deltaTime;
}
void btn_Reward()
{
if(m_timer > 0)
{
UnityAds.ShowAd();
if(UnityAds.FinishAd())
{
CoinSystem.m_coins += 100;
}
}
else
{
CoinSystem.m_coins += 100;
}
}
}
The problem I'm having here is if the user does not have want to have ads system instead doing something else to collect coins or they decided to collect the coins with just pressing a button without looking the ads, people would need to rewrite it, and also it breaks the SOILD principle. So I'm wondering is there any programming patterns can help me to solve this problrem ,thanks