Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

GameClear

0
Posted at

ミニトマト収穫祭
・ゲームクリア時のシーン移行フラグ処理
・adomob広告の非表示フラグ

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameClear : MonoBehaviour
{
    LifeGauge lifeGauge;
    public static int clearflag;
    public static bool admob;

    // Start is called before the first frame update
    void Start()
    {
        lifeGauge = FindObjectOfType<LifeGauge>();
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("GameClear") == true)
        {
            clearflag = 1;
            lifeGauge.GameClear();
        }
        else if (collision.gameObject.CompareTag("GameClear2") == true)
        {
            clearflag = 2;
            lifeGauge.GameClear();
        }
        else if (collision.gameObject.CompareTag("GameClear3") == true)
        {
            clearflag = 3;
                SceneManager.LoadScene("Clear2");
        }
        else if (collision.gameObject.CompareTag("admob") == true)
        {
            //Debug.Log("admob");
            admob = true;//adomob広告の非表示フラグ
        }
    }
}
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?