ScaleUpGameManager.cs
2.43 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ScaleUpGameManager : MonoBehaviour {
public Player player;
public EnemyController enemy;
public MissionCubeSpawner mcs;
AudioSource audioSource;
public bool onGame { get; set; }
public bool isAlive;
// Use this for initialization
private static ScaleUpGameManager instance;
public static ScaleUpGameManager Instance
{
get
{
if(instance == null)
{
instance = GameObject.FindObjectOfType<ScaleUpGameManager>();
}
return instance;
}
}
private void Awake()
{
//DontDestroyOnLoad(gameObject);
}
void Start()
{
player = FindObjectOfType<Player>();
if(player)
{
Debug.Log(player.name);
}
mcs = FindObjectOfType<MissionCubeSpawner>();
audioSource = GetComponent<AudioSource>();
isAlive = false;
//enemy.gameObject.SetActive(false);
player.gameObject.SetActive(false);
GameStart();
}
// Update is called once per frame
void Update()
{
}
public void GameStart()
{
UIController.Instance.GameStartUI();
}
//게임 오버 됐을때
public void GameOver()
{
//Debug.Log("ㄲㄲ");
// Destroy(player);
AudioManager.Instance.BackgroundSoundOff();
audioSource.PlayOneShot(audioSource.clip);
player.Die();
//Debug.Log("WW");
ScoreManager.Instance.SaveScore(UIController.Instance.timer);
UIController.Instance.GameOverUI();
//Debug.Log("haha");
isAlive = false;
//ScoreManager.Instance.MissionCubeCntToZero();
onGame = false;
}
public void onClickGameStart()
{
//mcs.DestroyAllCubes();
player.Revive();
//enemy.RestartEnemy();
UIController.Instance.GameStartUIClicked();
mcs.CreateMissionCube();
onGame = true;
UIController.Instance.UpdateHighScoreText();
}
public void onClickGameOver()
{
isAlive = false;
//UIController.Instance.GameOverUIClicked();
SceneManager.LoadScene("GaeGaeBiBall");
}
//Mission Cube 6개 먹으면 끝
//시간 재기
//Enemy한테 닿으면 죽음
}