示例#1
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
         return;
     }
     instance = this;
 }
 void Start()
 {
     currentStage          = 1;
     stg2ButtonActivations = 0;
     nextTrapSetTimer      = Time.time + trapCooldown - 1f;
     playerTransform       = GameObject.FindGameObjectWithTag("Player").transform;
     musicManager          = FindObjectOfType <MusicManagerScript>();
     musicManager.StartStage1Music();
 }
示例#3
0
 void OnDestroy()
 {
     //If you destroy the singleton elsewhere, reset the instance to null,
     //but don't reset it every time you destroy any instance of MusicManagerScript
     //because then the singleton pattern won't work (because the Singleton code in
     //Awake destroys it too)
     if (instance == this)
     {
         instance = null;
     }
 }
示例#4
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
示例#5
0
    private void Awake()
    {
        audioSource = GetComponent<AudioSource>();

        if (Instance != null && Instance != this) {
            Destroy(gameObject);
            return;
        } else {
            Instance = this;
        }
        DontDestroyOnLoad(gameObject);

        audioSource.clip = MusicClip;
        audioSource.Play();
    }
示例#6
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);

        audioSound = GetComponent <AudioSource>();
    }
示例#7
0
    void MovePlayer()
    {
        if (player == null)
        {
            return;
        }

        if (Music != BGM.NULL)
        {
            MusicManagerScript bgm = GameObject.FindObjectOfType <MusicManagerScript>();
            bgm.Play(Music);
        }

        Vector3 pos = player.position;

        pos.x           = target.x;
        pos.y           = target.y;
        player.position = pos;
    }
示例#8
0
 void Start()
 {
     musicManager           = GameObject.FindObjectOfType <MusicManagerScript>();
     volumeSlider.value     = PlayerPrefsManager.GetMasterVolume();
     difficultySlider.value = PlayerPrefsManager.GetDifficulty();
 }
示例#9
0
 void Awake()
 {
     Instance     = this;
     audioSource_ = GetComponent <AudioSource>();
 }
示例#10
0
    private void OnEnable()
    {
        musicManager = FindObjectOfType<MusicManagerScript>();

    }
示例#11
0
 void Awake()
 {
     Instance = this;
     DontDestroyOnLoad (gameObject);
 }
示例#12
0
 // Use this for initialization
 void Start()
 {
     musicManager = GameObject.FindObjectOfType <MusicManagerScript>();
 }
 void Awake()
 {
     instance = this;
 }