Nextrek
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
|
/*
*
* Adventure Creator
* by Chris Burton, 2013-2014
*
* "SceneChanger.cs"
*
* This script handles the changing of the scene, and stores
* which scene was previously loaded, for use by PlayerStart.
*
*/
using UnityEngine;
using System.Collections;
namespace AC
{
public class SceneChanger : MonoBehaviour
{
public int previousScene = -1;
public void ChangeScene (int sceneNumber, bool saveRoomData)
{
MainCamera mainCamera = GameObject.FindWithTag (Tags.mainCamera).GetComponent <MainCamera>();
mainCamera.FadeOut (0f);
Player player = GameObject.FindWithTag (Tags.player).GetComponent <Player>();
player.Halt ();
Sound[] sounds = FindObjectsOfType (typeof (Sound)) as Sound[];
foreach (Sound sound in sounds)
{
if (sound.canDestroy)
{
Destroy (sound);
}
}
LevelStorage levelStorage = this.GetComponent <LevelStorage>();
if (saveRoomData)
{
levelStorage.StoreCurrentLevelData ();
previousScene = Application.loadedLevel;
}
StateHandler stateHandler = this.GetComponent <StateHandler>();
stateHandler.gameState = GameState.Normal;
Application.LoadLevel (sceneNumber);
}
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|