private void Construct() { if (boostService == null) { boostService = Services.GetService <IX20BoostService>(); } }
public override void OnEnable() { base.OnEnable(); GameEvents.X20BoostStateChanged += OnBoostStateChanged; GameEvents.X20BoostMultStarted += OnBoostStarted; boostService = Services.GetService <IX20BoostService>(); button.SetListener(() => { switch (boostService.State) { case BoostState.Active: { boostService.ApplyBoost(); if (false == boostService.IsBoostRunning) { Sounds.PlayOneShot(SoundName.badgeUnlock); } else { Sounds.PlayOneShot(SoundName.click); } } break; case BoostState.ReadyToActivate: { boostService.Activate(); Services.GetService <ISoundService>().PlayOneShot(SoundName.Poof); } break; case BoostState.Locked: { boostService.SetAdStarted(true); Services.AdService.WatchAd("MegaBoost", () => { boostService.UnlockForAd(); //Services.GetService<ISoundService>().PlayOneShot(SoundName.click); }); } break; } }); }