Repository navigation
Expand file tree
/
Copy pathGameManager.cs
More file actions
109 lines (85 loc) · 2.97 KB
/
Copy pathGameManager.cs
File metadata and controls
109 lines (85 loc) · 2.97 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
105
106
107
108
109
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/*
Author: Evan Otero, Drew Hoo, and Will Bowdtich
Date: April 26, 2017
State
***********************
******* LICENSE *******
***********************
JoyceStick is a Boston College digital humanities project employing Unity
to construct a virtual reality game from Joyce’s Ulysses for viewing on the
HTC Vive, supported by a Teaching and Mentoring Grant and substantial funding
from internal bodies at Boston College.
Copyright (C) 2017 Evan Otero, Drew Hoo, Emaad Ali, Will Bowditch, Matt Harty, Jake Schafer, & Ryan Reede
http://joycestick.bc.edu/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
public class GameManager : MonoBehaviour
{
[SerializeField]
private SceneLoader sceneLoader;
[SerializeField]
private IState INTRODUCTION, TASK1, TASK2, COMPLETE;
private IState currentState;
private void Start() {
// Initialize States
INTRODUCTION.Init(this);
TASK1.Init(this);
TASK2.Init(this);
COMPLETE.Init(this);
// Start Game
setState(getIntroduction());
}
private void Update() { }
/* Actions */
public void loadLevel(string sceneName, bool userActivated) {
StartCoroutine(SceneLoader.instance.AsyncLoadScene(sceneName, userActivated));
}
public void playAudio(AudioClip clip, AudioSource source, float volumeScale) {
source.PlayOneShot(clip, volumeScale);
}
public void stopAudio(AudioSource source) {
source.Stop();
}
public void enableGrab(bool e) { }
public void enableUse(bool e) { }
public void showGameObject(GameObject go, bool e) {
if (e)
go.transform.localScale = new Vector3(1, 1, 1);
else
go.transform.localScale = new Vector3(0, 0, 0);
}
public void showLight(Light light, bool e) {
if (light.enabled != e)
light.enabled = e;
}
/* Getters */
public IState getIntroduction() {
return INTRODUCTION;
}
public IState getTask1() {
return TASK1;
}
public IState getTask2() {
return TASK2;
}
public IState getComplete() {
return COMPLETE;
}
/* Setters */
public void setState(IState state) {
currentState = state;
currentState.Run();
}
}