-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHowToUI.cs
50 lines (44 loc) · 1.55 KB
/
HowToUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HowToUI : MonoBehaviour {
public AudioClip menuMusic;
public AudioClip buttonPressSound;
private Animator abductorAnimator;
private Animator playerAnimator;
private GameObject playerHowTo;
private GameObject abductorCollider;
private LevelManager levelManager;
private MusicManager musicManager;
private AudioSource howToAudioSource;
void Awake() {
playerHowTo = GameObject.Find ("Player_How_To");
playerAnimator = playerHowTo.GetComponent<Animator> ();
playerAnimator.SetBool ("isHowTo", true);
abductorCollider = playerHowTo.transform.Find ("AbductorCollider").gameObject;
abductorAnimator = abductorCollider.GetComponent<Animator> ();
abductorAnimator.speed = 0.25f;
abductorAnimator.SetBool ("isHowTo", true);
levelManager = FindObjectOfType<LevelManager> ();
howToAudioSource = gameObject.AddComponent<AudioSource> () as AudioSource;
howToAudioSource.clip = buttonPressSound;
if (levelManager == null) {
levelManager = new GameObject ().AddComponent (typeof(LevelManager)) as LevelManager;
}
musicManager = FindObjectOfType<MusicManager> ();
if (musicManager == null) {
musicManager = new GameObject ().AddComponent (typeof(MusicManager)) as MusicManager;
DontDestroyOnLoad (musicManager);
musicManager.SetBackgroundMusic (menuMusic);
musicManager.Play ();
}
}
public void TransitionExit() {
howToAudioSource.Play ();
Invoke ("Exit", 0.3f);
}
private void Exit() {
levelManager.Load ("Menu");
}
}