-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.cs
67 lines (57 loc) · 1.49 KB
/
Core.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
66
67
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Cubes
{
/// <summary>
/// The base sigleton controller class.
/// </summary>
public sealed class Core
{
private static Core instance = null;
private Level currentLevel;
private LevelLoader lvlLoader;
public Level CurrentLevel
{
get { return currentLevel; }
set { currentLevel = value; }
}
public LevelLoader LevelLoader
{
get { return lvlLoader; }
}
/// <summary>
/// Persuades to the next level
/// </summary>
public void levelDone(){
CurrentLevel = lvlLoader.loadLevel(currentLevel.LevelNumber + 1);
}
/// <summary>
/// Resets the current level.
/// </summary>
public void levelReset(){
CurrentLevel = lvlLoader.loadLevel(currentLevel.LevelNumber);
}
/// <summary>
/// For getting the base-controler.
/// </summary>
/// <returns>The singleton-instance of Core.</returns>
public static Core Instance{
get{
if (instance == null)
instance = new Core();
return instance;
}
}
/// <summary>
/// Initial actions before the first level starts
/// </summary>
private Core()
{
lvlLoader = new LevelLoader("level.cls");
CurrentLevel = lvlLoader.loadLevel(0);
ThreadPool.QueueUserWorkItem(Renderer.run);
}
}
}