-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpaceInvaders.cs
More file actions
44 lines (42 loc) · 1.19 KB
/
SpaceInvaders.cs
File metadata and controls
44 lines (42 loc) · 1.19 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpaceInvaders : MonoBehaviour
{
public static int HorizontalMax, VerticalMax;
public static int score, lifes, currentLifes;
public static int level;
public static bool drawBackground;
public static bool lightingEffects;
public static void SetDefault()
{
AudioListener.volume = PlayerPrefs.GetFloat("Volume");
drawBackground = (PlayerPrefs.GetInt("Background", 1) == 1 ? true : false);
lightingEffects = (PlayerPrefs.GetInt("LightingEffects", 0) == 1 ? true : false);
if (HorizontalMax == 0)
{
HorizontalMax = PlayerPrefs.GetInt("HorizontalMax", 11);
}
if (VerticalMax == 0)
{
VerticalMax = PlayerPrefs.GetInt("VerticalMax", 5);
}
if (level == 0)
{
level = 1;
}
if (lifes <= 0 || lifes > 5)
{
lifes = PlayerPrefs.GetInt("Lifes", 3);
}
if (currentLifes > 5)
{
currentLifes = 5;
}
if (level == 1)
{
currentLifes = lifes;
score = 0;
}
}
}