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
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
*
* Adventure Creator
* by Chris Burton, 2013-2014
*
* "GameCamera25D.cs"
*
* This GameCamera is fixed, but allows for a background image to be displayed.
*
*/
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class GameCamera25D : _Camera
{
public BackgroundImage backgroundImage;
private void Awake ()
{
this.camera.enabled = false;
}
public void SetActiveBackground ()
{
if (backgroundImage)
{
// Move background images onto correct layer
BackgroundImage[] backgroundImages = FindObjectsOfType (typeof (BackgroundImage)) as BackgroundImage[];
foreach (BackgroundImage image in backgroundImages)
{
if (image == backgroundImage)
{
image.TurnOn ();
}
else
{
image.TurnOff ();
}
}
// Turn BackgroundCamera on
if (GameObject.FindWithTag (Tags.backgroundCamera) && GameObject.FindWithTag (Tags.backgroundCamera).GetComponent <BackgroundCamera>())
{
BackgroundCamera backgroundCamera = GameObject.FindWithTag (Tags.backgroundCamera).GetComponent <BackgroundCamera>();
backgroundCamera.TurnOn ();
}
else
{
Debug.LogWarning ("No BackgroundCamera found - please use the Scene Manager to Organise Room Objects with 2.5D Camera Projection.");
}
if (GameObject.FindWithTag (Tags.mainCamera) && GameObject.FindWithTag (Tags.mainCamera).GetComponent <Camera>())
{
MainCamera mainCamera = GameObject.FindWithTag (Tags.mainCamera).GetComponent <MainCamera>();
// Set MainCamera's Clear Flags
mainCamera.PrepareForBackground ();
}
else
{
Debug.LogWarning ("No MainCamera found - please use the Scene Manager to Organise Room Objects.");
}
}
}
public void SnapCameraInEditor ()
{
if (GameObject.FindWithTag (Tags.mainCamera) && GameObject.FindWithTag (Tags.mainCamera).GetComponent <Camera>())
{
MainCamera mainCamera = GameObject.FindWithTag (Tags.mainCamera).GetComponent <MainCamera>();
mainCamera.transform.parent = this.transform;
mainCamera.transform.localPosition = Vector3.zero;
mainCamera.transform.localEulerAngles = Vector3.zero;
mainCamera.GetComponent <Camera>().isOrthoGraphic = this.GetComponent <Camera>().isOrthoGraphic;
mainCamera.GetComponent <Camera>().fieldOfView = this.GetComponent <Camera>().fieldOfView;
mainCamera.GetComponent <Camera>().farClipPlane = this.GetComponent <Camera>().farClipPlane;
mainCamera.GetComponent <Camera>().nearClipPlane = this.GetComponent <Camera>().nearClipPlane;
mainCamera.GetComponent <Camera>().orthographicSize = this.GetComponent <Camera>().orthographicSize;
}
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|