-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameHandler.cs
65 lines (52 loc) · 1.33 KB
/
GameHandler.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class GameHandler : MonoBehaviour {
//Parameters
[Header("General Settings")]
public float textSpeed = 10;
[Header("Game Settings")]
public float gameSpeed;
public float characterSpeed;
public float cursorReach;
[System.Serializable]
public class LevelSettings{
public float spawnRate;
public float astroidSpeed;
public float spaceShipSpeed;
}
public LevelSettings[] levels;
[Header("Assignable objects")]
public GameObject character;
private int currentLevel;
public static GameHandler instance = null;
void Awake (){
if (instance == null)
instance = this;
}
private const float aspect = 1280.0F / 720.0F;
void Start () {
Camera.main.aspect = aspect; //TODO
Camera.main.orthographicSize = 720/2;
currentLevel = 0;
}
// Update is called once per frame
void Update () {
}
public void nextLevel(){
//Activate the ennemy spawner
}
public Vector2 getScreenMax(){ //We assert that min is -max
return new Vector2(Camera.main.orthographicSize*aspect, Camera.main.orthographicSize);
}
public GameObject getCharacter (){
return character;
}
public LevelSettings getCurrentLevel(){
return levels [currentLevel];
}
public float getCharacterSpeed (){
return gameSpeed * characterSpeed;
}
}