void MakeSingleton() { if (Instance != null) { Destroy(gameObject); } else { Instance = this; DontDestroyOnLoad(gameObject); } }
void FindGameObjectsWithTag() { bottleToCollet = GameObject.FindGameObjectsWithTag("Bottle").Length; bottleOpenSound = GameObject.FindGameObjectWithTag("Sound").GetComponent <AudioSource>(); jumpSound = GameObject.FindGameObjectWithTag("Jump").GetComponent <AudioSource>(); virus_bg = GameObject.FindGameObjectsWithTag("Virus_bg"); spriteRenderer = GetComponent <SpriteRenderer>(); googleAdScript = GameObject.FindGameObjectWithTag("Google_Ad").GetComponent <admobdemo>(); googleAdScript.HideBanner(); transform.localScale = Vector3.one * playerSize[0]; spriteRenderer.sprite = playerSprite[0]; }
public void DisplayAd() { // Add a logic to check if (googleAdScript == null) { googleAdScript = GameObject.FindGameObjectWithTag("Google_Ad").GetComponent <admobdemo>(); } if (UTIL.canShowRewardAd) { if (Random.Range(0, 10) > 2) { googleAdScript.ShowRewardVideo(); } } else { UTIL.canShowRewardAd = false; } }
void Awake() { DontDestroyOnLoad(transform.gameObject); mInstance = this; }