Inheritance: MonoBehaviour
Example #1
0
 void MakeSingleton()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Example #2
0
    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];
    }
Example #3
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;
        }
    }
Example #4
0
 void Awake()
 {
     DontDestroyOnLoad(transform.gameObject);
     mInstance = this;
 }