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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
*
* Adventure Creator
* by Chris Burton, 2013-2014
*
* "PlayerStart.cs"
*
* This script defines a possible starting position for the
* player when the scene loads, based on what the previous
* scene was. If no appropriate PlayerStart is found, the
* one define in StartSettings is used as the default.
*
*/
using UnityEngine;
using System.Collections;
using AC;
public class PlayerStart : Marker
{
public bool fadeInOnStart;
public float fadeSpeed = 0.5f;
public int previousScene;
public _Camera cameraOnStart;
private GameObject playerOb;
public void SetPlayerStart ()
{
if (GameObject.FindWithTag (Tags.mainCamera) && GameObject.FindWithTag (Tags.mainCamera).GetComponent <MainCamera>())
{
MainCamera mainCam = GameObject.FindWithTag (Tags.mainCamera).GetComponent <MainCamera>();
if (mainCam && fadeInOnStart)
{
mainCam.FadeIn (fadeSpeed);
}
if (AdvGame.GetReferences () && AdvGame.GetReferences ().settingsManager)
{
SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager;
playerOb = GameObject.FindWithTag (Tags.player);
if (playerOb)
{
playerOb.transform.position = this.transform.position;
playerOb.transform.rotation = this.transform.rotation;
if (settingsManager.ActInScreenSpace ())
{
playerOb.transform.position = AdvGame.GetScreenNavMesh (playerOb.transform.position);
}
}
if (settingsManager.movementMethod == MovementMethod.FirstPerson)
{
mainCam.SetFirstPerson ();
}
else if (cameraOnStart && mainCam)
{
mainCam.SetGameCamera (cameraOnStart);
mainCam.lastNavCamera = cameraOnStart;
cameraOnStart.MoveCameraInstant ();
mainCam.SetGameCamera (cameraOnStart);
mainCam.SnapToAttached ();
}
else if (cameraOnStart == null)
{
Debug.LogWarning (this.name + " has no Camera On Start");
}
}
}
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|