SystemScr









How do I use System Scr
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: Enemy.cs Copy
30     void Start()
31     {
32         if (enemyType != 0 && enemyType != 4)//not a boss or not a boss ring
33         {
34             if (SystemScr.difficultyIsHard)
35                 lifeMax = 2;
36             else
37                 lifeMax = 1;
38         }
39
40         life = lifeMax;
41     }
File name: SoundManager.cs Copy
16     void Start()
17     {
18         if (!SystemScr.mute)
19             PlayMusic(true);
20     }
File name: SoundManager.cs Copy
22     public void PlaySoundsPlayer(int soundNumber)
23     {
24         if (SystemScr.mute)
25             return;
26
27         if (soundNumber == 0)
28             audSources[0].clip = shot;
29         else if (soundNumber == 1)
30             audSources[0].clip = p_harm;
31         else if (soundNumber == 2)
32             audSources[0].clip = p_dead;
33         else if(soundNumber == 3)
34             audSources[0].clip = pickup;
35
36         audSources[0].Play();
37     }
File name: SoundManager.cs Copy
39     public void PlaySoundsEnemy()
40     {
41         if (SystemScr.mute)
42             return;
43         audSources[1].clip = dead;
44         audSources[1].Play();
45     }
File name: SoundManager.cs Copy
47     public void PlaySoundsUI(bool buttonSound)
48     {
49         if (SystemScr.mute)
50             return;
51         if (buttonSound)
52             audSources[2].clip = button;
53         else
54             audSources[2].clip = pause;
55
56         audSources[2].Play();
57     }
File name: SpawnManager.cs Copy
42     IEnumerator SpawningRoutine()
43     {
44         yield return new WaitForSeconds(3);
45
46         while (!UIgame.scoreAchived)
47         {
48             GameObject enemy = null;
49
50             //FIRST STAGE OF SPAWNING
51             //CHOOSE ENEMY FOR SPAWN
52             int r = rand.Randomization_1(0, 10, 80, 99);
53             if (r == 0)
54             {
55                 enemy = pools.GetPoolableObject("enemy_01");
56             }
57             else if (r == 1)
58             {
59                 enemy = pools.GetPoolableObject("enemy_02");
60             }
61             else
62             {
63                 enemy = pools.GetPoolableObject("enemy_03");
64             }
65
66             //SECOND STAGE OF SPAWNING
67             //SPAWN CHOSEN ENEMY IN RANDOM POINT ON TOP SCREEN SIDE
68             r = Random.Range(0, pointsPositions.Length);
69
70             if (enemy != null)
71             {
72                 enemy.SetActive(true);
73                 enemy.GetComponent().Activation(new Vector3(pointsPositions[r], 2, strtSpawn.position.z),
74                     new Vector3(0,0,-1));
75             }
76
77             int spawnDelay;
78             if (SystemScr.difficultyIsHard)
79                 spawnDelay = 1;
80             else
81                 spawnDelay = Random.Range(3,5);
82
83             yield return new WaitForSeconds(spawnDelay);
84         }
85
86         //BOSS ACTIVATION
87         pools.DeleteEnemiesAndBullets();
88         CameraMotor.speedScreen = 0;
89         Camera.main.GetComponent().city_1.gameObject.SetActive(false);//remove city1
90         Camera.main.GetComponent().city_2.gameObject.SetActive(false);//remove city2
91         Camera.main.backgroundColor = Color.black;
92         GameObject.FindObjectOfType().BossMusicOn();
93
94         yield return new WaitForSeconds(6);
95
96         pools.AcivateBoss();
97     }
File name: UIgame.cs Copy
31     void Start()
32     {
33         if (SystemScr.difficultyIsHard)
34             maximumScore = 2000;
35         else
36             maximumScore = 1000;
37
38         scoreText.text = score + "/" + maximumScore;
39         scoreAchived = false;
40
41         if (SystemScr.mute)
42             muteText.text = "ON";
43     }
File name: UIgame.cs Copy
100     public void Pause_btn()
101     {
102         if (SystemScr.paused)
103         {
104             Resume_btn();
105         }
106         else
107         {
108             sounds.PlaySoundsUI(false);
109
110             SystemScr.Pause(true);
111             GameScreen.SetActive(false);
112             PauseScreen.SetActive(true);
113         }
114     }
File name: UIgame.cs Copy
116     public void Resume_btn()
117     {
118         sounds.PlaySoundsUI(false);
119
120         SystemScr.Pause(false);
121         GameScreen.SetActive(true);
122         PauseScreen.SetActive(false);
123         OptionsScreen.SetActive(false);
124     }
File name: UIgame.cs Copy
133     public void ExitFromPauseToMainMenu_btn()
134     {
135         SystemScr.Pause(false);
136         SceneManager.LoadScene("MenuScene");
137     }

Download file with original file name:SystemScr

SystemScr 139 lượt xem

Gõ tìm kiếm nhanh...