@@ -10,6 +10,13 @@ public enum CameraType
1010 NumTypes ,
1111}
1212
13+ public enum OrbitalDirection
14+ {
15+ Right ,
16+ Left ,
17+ Dynamic
18+ }
19+
1320public class CameraData
1421{
1522 public String Name ;
@@ -26,6 +33,7 @@ public class CameraData
2633 public float TransitionTime ;
2734 public CameraTransitionCurve TransitionCurve ;
2835 public bool ReleaseBehindPlayer = false ;
36+ public OrbitalDirection Direction = OrbitalDirection . Dynamic ;
2937
3038 public Vector3 SmoothedPositionBinding = Vector3 . zero ;
3139 public Vector3 SmoothedLookAtBinding = Vector3 . zero ;
@@ -62,6 +70,15 @@ Vector3 EvaluateBinding(PluginCameraHelper helper, string binding)
6270 }
6371 }
6472
73+ public void ResetSmoothing ( PluginCameraHelper helper )
74+ {
75+ var newLookat = EvaluateBinding ( helper , LookAtBinding ) + LookAt ;
76+ var newPos = EvaluateBinding ( helper , PositionBinding ) + PositionOffset ;
77+
78+ SmoothedLookAtBinding = newLookat ;
79+ SmoothedPositionBinding = newPos ;
80+ }
81+
6582 public override string ToString ( )
6683 {
6784 return "Camera: " + this . Name + ", Type: " + this . Type . ToString ( ) + ", PositionBinding: " + this . PositionBinding + ", PositionOffset: "
@@ -110,8 +127,8 @@ public static void LoadSettings()
110127 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
111128 ws . WriteLine ( " PositionOffset={x='0.5', y='1.3', z='-2.0'} " ) ;
112129 ws . WriteLine ( " LookAt={x='0.0', y='-0.5', z='1.0'} " ) ;
113- ws . WriteLine ( " MinTime='4 .0' " ) ;
114- ws . WriteLine ( " MaxTime='8 .0' " ) ;
130+ ws . WriteLine ( " MinTime='8 .0' " ) ;
131+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
115132 ws . WriteLine ( " TransitionTime='2.0'" ) ;
116133 ws . WriteLine ( "}" ) ;
117134 ws . WriteLine ( "Camera={" ) ;
@@ -120,8 +137,8 @@ public static void LoadSettings()
120137 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
121138 ws . WriteLine ( " PositionOffset={x='0.0', y='2.0', z='-2.0'} " ) ;
122139 ws . WriteLine ( " LookAt={x='0.0', y='-0.5', z='1.0'} " ) ;
123- ws . WriteLine ( " MinTime='4 .0' " ) ;
124- ws . WriteLine ( " MaxTime='8 .0' " ) ;
140+ ws . WriteLine ( " MinTime='8 .0' " ) ;
141+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
125142 ws . WriteLine ( " TransitionTime='2.0'" ) ;
126143 ws . WriteLine ( "}" ) ;
127144 ws . WriteLine ( "Camera={" ) ;
@@ -130,8 +147,8 @@ public static void LoadSettings()
130147 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
131148 ws . WriteLine ( " PositionOffset={x='-0.5', y='1.3', z='-2.0'} " ) ;
132149 ws . WriteLine ( " LookAt={x='0.0', y='-0.5', z='1.0'} " ) ;
133- ws . WriteLine ( " MinTime='4 .0' " ) ;
134- ws . WriteLine ( " MaxTime='8 .0' " ) ;
150+ ws . WriteLine ( " MinTime='8 .0' " ) ;
151+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
135152 ws . WriteLine ( " TransitionTime='2.0'" ) ;
136153 ws . WriteLine ( "}" ) ;
137154 ws . WriteLine ( "Camera={" ) ;
@@ -140,8 +157,8 @@ public static void LoadSettings()
140157 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
141158 ws . WriteLine ( " PositionOffset={x='0.75', y='0.0', z='-2.0'} " ) ;
142159 ws . WriteLine ( " LookAt={x='0.0', y='0.0', z='1.0'} " ) ;
143- ws . WriteLine ( " MinTime='4 .0' " ) ;
144- ws . WriteLine ( " MaxTime='8 .0' " ) ;
160+ ws . WriteLine ( " MinTime='8 .0' " ) ;
161+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
145162 ws . WriteLine ( " TransitionTime='2.0'" ) ;
146163 ws . WriteLine ( "}" ) ;
147164 ws . WriteLine ( "Camera={" ) ;
@@ -150,8 +167,8 @@ public static void LoadSettings()
150167 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
151168 ws . WriteLine ( " PositionOffset={x='-0.75', y='0.0', z='-2.0'} " ) ;
152169 ws . WriteLine ( " LookAt={x='0.0', y='0.0', z='1.0'} " ) ;
153- ws . WriteLine ( " MinTime='4 .0' " ) ;
154- ws . WriteLine ( " MaxTime='8 .0' " ) ;
170+ ws . WriteLine ( " MinTime='8 .0' " ) ;
171+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
155172 ws . WriteLine ( " TransitionTime='2.0'" ) ;
156173 ws . WriteLine ( "}" ) ;
157174 ws . WriteLine ( "Camera={" ) ;
@@ -164,35 +181,35 @@ public static void LoadSettings()
164181 ws . WriteLine ( " LookAtBinding='playerWaist'" ) ;
165182 ws . WriteLine ( " LookAt={x='0.0', y='0.0', z='0.0'} " ) ;
166183 ws . WriteLine ( " MinTime='8.0' " ) ;
167- ws . WriteLine ( " MaxTime='8 .0' " ) ;
184+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
168185 ws . WriteLine ( " TransitionTime='2.0'" ) ;
169186 ws . WriteLine ( " ReleaseBehindPlayer='true'" ) ;
170187 ws . WriteLine ( "}" ) ;
171188 ws . WriteLine ( "Camera={" ) ;
172189 ws . WriteLine ( " Name='Orbital2'" ) ;
173190 ws . WriteLine ( " Type='Orbital'" ) ;
174- ws . WriteLine ( " Distance='3 .0'" ) ;
191+ ws . WriteLine ( " Distance='4 .0'" ) ;
175192 ws . WriteLine ( " Speed='1.0'" ) ;
176193 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
177194 ws . WriteLine ( " PositionOffset={x='0.0', y='0.0', z='0.0'} " ) ;
178195 ws . WriteLine ( " LookAtBinding='playerWaist'" ) ;
179196 ws . WriteLine ( " LookAt={x='0.0', y='0.0', z='0.0'} " ) ;
180197 ws . WriteLine ( " MinTime='8.0' " ) ;
181- ws . WriteLine ( " MaxTime='8 .0' " ) ;
198+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
182199 ws . WriteLine ( " TransitionTime='2.0'" ) ;
183200 ws . WriteLine ( " ReleaseBehindPlayer='true'" ) ;
184201 ws . WriteLine ( "}" ) ;
185202 ws . WriteLine ( "Camera={" ) ;
186203 ws . WriteLine ( " Name='Orbital3'" ) ;
187204 ws . WriteLine ( " Type='Orbital'" ) ;
188- ws . WriteLine ( " Distance='3 .0'" ) ;
205+ ws . WriteLine ( " Distance='5 .0'" ) ;
189206 ws . WriteLine ( " Speed='1.0'" ) ;
190207 ws . WriteLine ( " PositionBinding='playerWaist'" ) ;
191208 ws . WriteLine ( " PositionOffset={x='0.0', y='0.0', z='0.0'} " ) ;
192209 ws . WriteLine ( " LookAtBinding='playerWaist'" ) ;
193210 ws . WriteLine ( " LookAt={x='0.0', y='0.0', z='0.0'} " ) ;
194211 ws . WriteLine ( " MinTime='8.0' " ) ;
195- ws . WriteLine ( " MaxTime='8 .0' " ) ;
212+ ws . WriteLine ( " MaxTime='12 .0' " ) ;
196213 ws . WriteLine ( " TransitionTime='2.0'" ) ;
197214 ws . WriteLine ( " ReleaseBehindPlayer='true'" ) ;
198215 ws . WriteLine ( "}" ) ;
@@ -290,6 +307,7 @@ public static CameraData ParseCamera(ReflectionToken camera)
290307 outCamera . TransitionTime = ParseFloat ( camera . GetChildSafe ( "TransitionTime" ) ) ;
291308 outCamera . TransitionCurve = GetTransitionCurveFromToken ( camera . GetChildSafe ( "TransitionCurve" ) ) ;
292309 outCamera . ReleaseBehindPlayer = ParseBool ( camera . GetChildSafe ( "ReleaseBehindPlayer" ) ) ;
310+ outCamera . Direction = GetOrbitalDirectionFromToken ( camera . GetChildSafe ( "Direction" ) ) ;
293311
294312 return outCamera ;
295313 }
@@ -317,28 +335,40 @@ public static float ParseFloat(ReflectionToken token)
317335 return 0.0f ;
318336 }
319337
320- public static CameraType GetCameraTypeFromToken ( ReflectionToken token )
338+ public static OrbitalDirection GetOrbitalDirectionFromToken ( ReflectionToken token )
321339 {
322- if ( token . mValue == "Orbital" )
323- {
324- return CameraType . Orbital ;
325- }
326- if ( token . mValue == "LookAt" )
327- {
328- return CameraType . LookAt ;
340+ switch ( token . mValue . ToLower ( ) ) {
341+ case "right" :
342+ return OrbitalDirection . Right ;
343+ case "left" :
344+ return OrbitalDirection . Left ;
345+ case "dynamic" :
346+ return OrbitalDirection . Dynamic ;
347+ default :
348+ return OrbitalDirection . Dynamic ;
329349 }
350+ }
330351
331- return CameraType . LookAt ;
352+ public static CameraType GetCameraTypeFromToken ( ReflectionToken token )
353+ {
354+ switch ( token . mValue . ToLower ( ) ) {
355+ case "orbital" :
356+ return CameraType . Orbital ;
357+ case "lookat" :
358+ return CameraType . LookAt ;
359+ default :
360+ return CameraType . LookAt ;
361+ }
332362 }
333363
334364 public static CameraTransitionCurve GetTransitionCurveFromToken ( ReflectionToken token )
335365 {
336- switch ( token . mValue ) {
337- case "EaseOutCubic " :
366+ switch ( token . mValue . ToLower ( ) ) {
367+ case "easeoutcubic " :
338368 return CameraTransitionCurve . EaseOutCubic ;
339- case "EaseInOutCubic " :
369+ case "easeinoutcubic " :
340370 return CameraTransitionCurve . EaseInOutCubic ;
341- case "Linear " :
371+ case "linear " :
342372 return CameraTransitionCurve . Linear ;
343373 default :
344374 return CameraTransitionCurve . EaseOutCubic ;
0 commit comments