예제 #1
0
 void Awake()
 {
     if (bgmInstance == null)
     {
         bgmInstance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #2
0
 //追加9/17
 private void Start()
 {
     checkPoint = GameObject.FindGameObjectWithTag("Player").GetComponent <CheckPoint>();
     enemies    = GameObject.FindGameObjectsWithTag("Enemy");
     bgmScript  = GameObject.FindWithTag("MainCamera").GetComponent <BGMScript>();
     enemyNum   = enemies.Length;
     enemyRobot = new EnemyRobot[enemyNum];
     Debug.Log(enemyNum);
     for (int i = 0; i < enemyNum; i++)
     {
         enemyRobot[i] = enemies[i].GetComponent <EnemyRobot>();
     }
 }
예제 #3
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #4
0
    // Use this for initialization

    private void Awake()
    {
        if (bgmInstance != null)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            bgmInstance = this;
        }
        DontDestroyOnLoad(this.gameObject);
    }
예제 #5
0
    // Use this for initialization

    void Start()
    {
        if (BGM == null)
        {
            BGM = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
예제 #6
0
 void Awake()
 {
     if (!instance)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         audioSource      = GetComponent <AudioSource> ();
         audioSource.loop = true;
         originalVolume   = audioSource.volume;
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     Current = this;
     aud     = GetComponent <AudioSource>();
 }
예제 #8
0
 // Start is called before the first frame update
 void Start()
 {
     bgmScript = GameObject.FindWithTag("MainCamera").GetComponent <BGMScript>();
 }