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
|
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor (typeof (GameCamera2D))]
public class GameCamera2DEditor : Editor
{
public override void OnInspectorGUI ()
{
GameCamera2D _target = (GameCamera2D) target;
EditorGUILayout.BeginVertical ("Button");
EditorGUILayout.LabelField ("Horizontal movement", EditorStyles.boldLabel);
_target.lockHorizontal = EditorGUILayout.Toggle ("Lock?", _target.lockHorizontal);
_target.afterOffset.x = EditorGUILayout.FloatField ("Offset:", _target.afterOffset.x);
if (!_target.lockHorizontal)
{
_target.freedom.x = EditorGUILayout.FloatField ("Track freedom:",_target.freedom.x);
_target.limitHorizontal = EditorGUILayout.BeginToggleGroup ("Constrain?", _target.limitHorizontal);
EditorGUILayout.BeginVertical ("Button");
_target.constrainHorizontal[0] = EditorGUILayout.FloatField ("Minimum:", _target.constrainHorizontal[0]);
_target.constrainHorizontal[1] = EditorGUILayout.FloatField ("Maximum:", _target.constrainHorizontal[1]);
EditorGUILayout.EndVertical ();
EditorGUILayout.EndToggleGroup ();
}
EditorGUILayout.EndVertical ();
EditorGUILayout.BeginVertical ("Button");
EditorGUILayout.LabelField ("Vertical movement", EditorStyles.boldLabel);
_target.lockVertical = EditorGUILayout.Toggle ("Lock?", _target.lockVertical);
_target.afterOffset.y = EditorGUILayout.FloatField ("Offset:", _target.afterOffset.y);
if (!_target.lockVertical)
{
_target.freedom.y = EditorGUILayout.FloatField ("Track freedom:",_target.freedom.y);
_target.limitVertical = EditorGUILayout.BeginToggleGroup ("Constrain?", _target.limitVertical);
EditorGUILayout.BeginVertical ("Button");
_target.constrainVertical[0] = EditorGUILayout.FloatField ("Minimum:", _target.constrainVertical[0]);
_target.constrainVertical[1] = EditorGUILayout.FloatField ("Maximum:", _target.constrainVertical[1]);
EditorGUILayout.EndVertical ();
EditorGUILayout.EndToggleGroup ();
}
EditorGUILayout.EndVertical ();
if (!_target.lockHorizontal || !_target.lockVertical)
{
EditorGUILayout.BeginVertical ("Button");
EditorGUILayout.LabelField ("Target object to control camera movement", EditorStyles.boldLabel);
_target.targetIsPlayer = EditorGUILayout.Toggle ("Target is player?", _target.targetIsPlayer);
if (!_target.targetIsPlayer)
{
_target.target = (Transform) EditorGUILayout.ObjectField ("Target:", _target.target, typeof(Transform), true);
}
_target.dampSpeed = EditorGUILayout.FloatField ("Follow speed", _target.dampSpeed);
EditorGUILayout.EndVertical ();
}
if (!_target.IsCorrectRotation ())
{
if (GUILayout.Button ("Set correct rotation"))
{
Undo.RecordObject (_target, "Clear " + _target.name + " rotation");
_target.SetCorrectRotation ();
}
}
if (!Application.isPlaying)
{
_target.camera.ResetProjectionMatrix ();
_target.SnapToOffset ();
}
if (GUI.changed)
{
EditorUtility.SetDirty (_target);
}
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|