A game about forced loneliness, made by TACStudios
1namespace UnityEngine.EventSystems
2{
3 /// <summary>
4 /// This is an 4 direction movement enum.
5 /// </summary>
6 /// <remarks>
7 /// MoveDirection provides a way of switching between moving states. You must assign these states to actions, such as moving the GameObject by an up vector when in the Up state.
8 /// Having states like these are easier to identify than always having to include a large amount of vectors and calculations.Instead, you define what you want the state to do in only one part, and switch to the appropriate state when it is needed.
9 /// </remarks>
10 /// <example>
11 /// <code>
12 /// <![CDATA[
13 /// //This is a full example of how a GameObject changes direction using MoveDirection states
14 /// //Assign this script to a visible GameObject (with a Rigidbody attached) to see it in action
15 ///
16 /// using UnityEngine;
17 /// using UnityEngine.EventSystems;
18 ///
19 /// public class Example : MonoBehaviour
20 /// {
21 /// Vector3 m_StartPosition, m_StartForce;
22 /// Rigidbody m_Rigidbody;
23 /// //Use Enum for easy switching between direction states
24 /// MoveDirection m_MoveDirection;
25 ///
26 /// //Use these Vectors for moving Rigidbody components
27 /// Vector3 m_ResetVector;
28 /// Vector3 m_UpVector;
29 /// Vector3 m_RightVector;
30 /// const float speed = 5.0f;
31 ///
32 /// void Start()
33 /// {
34 /// //You get the Rigidbody component attached to the GameObject
35 /// m_Rigidbody = GetComponent<Rigidbody>();
36 /// //This starts with the Rigidbody not moving in any direction at all
37 /// m_MoveDirection = MoveDirection.None;
38 ///
39 /// //These are the GameObject’s starting position and Rigidbody position
40 /// m_StartPosition = transform.position;
41 /// m_StartForce = m_Rigidbody.transform.position;
42 ///
43 /// //This Vector is set to 1 in the y axis (for moving upwards)
44 /// m_UpVector = Vector3.up;
45 /// //This Vector is set to 1 in the x axis (for moving in the right direction)
46 /// m_RightVector = Vector3.right;
47 /// //This Vector is zeroed out for when the Rigidbody should not move
48 /// m_ResetVector = Vector3.zero;
49 /// }
50 ///
51 /// void Update()
52 /// {
53 /// //This switches the direction depending on button presses
54 /// switch (m_MoveDirection)
55 /// {
56 /// //The starting state which resets the object
57 /// case MoveDirection.None:
58 /// //Reset to the starting position of the GameObject and Rigidbody
59 /// transform.position = m_StartPosition;
60 /// m_Rigidbody.transform.position = m_StartForce;
61 /// //This resets the velocity of the Rigidbody
62 /// m_Rigidbody.velocity = m_ResetVector;
63 /// break;
64 ///
65 /// //This is for moving in an upwards direction
66 /// case MoveDirection.Up:
67 /// //Change the velocity so that the Rigidbody travels upwards
68 /// m_Rigidbody.velocity = m_UpVector * speed;
69 /// break;
70 ///
71 /// //This is for moving left
72 /// case MoveDirection.Left:
73 /// //This moves the Rigidbody to the left (minus right Vector)
74 /// m_Rigidbody.velocity = -m_RightVector * speed;
75 /// break;
76 ///
77 /// //This is for moving right
78 /// case MoveDirection.Right:
79 /// //This moves the Rigidbody to the right
80 /// m_Rigidbody.velocity = m_RightVector * speed;
81 /// break;
82 ///
83 /// //This is for moving down
84 /// case MoveDirection.Down:
85 /// //This moves the Rigidbody down
86 /// m_Rigidbody.velocity = -m_UpVector * speed;
87 /// break;
88 /// }
89 /// }
90 ///
91 /// void OnGUI()
92 /// {
93 /// //Press the reset Button to switch to no mode
94 /// if (GUI.Button(new Rect(100, 0, 150, 30), "Reset"))
95 /// {
96 /// //Switch to start/reset case
97 /// m_MoveDirection = MoveDirection.None;
98 /// }
99 ///
100 /// //Press the Left button to switch the Rigidbody direction to the left
101 /// if (GUI.Button(new Rect(100, 30, 150, 30), "Move Left"))
102 /// {
103 /// //Switch to the left direction
104 /// m_MoveDirection = MoveDirection.Left;
105 /// }
106 ///
107 /// //Press the Up button to switch the Rigidbody direction to upwards
108 /// if (GUI.Button(new Rect(100, 60, 150, 30), "Move Up"))
109 /// {
110 /// //Switch to Up Direction
111 /// m_MoveDirection = MoveDirection.Up;
112 /// }
113 ///
114 /// //Press the Down button to switch the direction to down
115 /// if (GUI.Button(new Rect(100, 90, 150, 30), "Move Down"))
116 /// {
117 /// //Switch to Down Direction
118 /// m_MoveDirection = MoveDirection.Down;
119 /// }
120 ///
121 /// //Press the right button to switch to the right direction
122 /// if (GUI.Button(new Rect(100, 120, 150, 30), "Move Right"))
123 /// {
124 /// //Switch to Right Direction
125 /// m_MoveDirection = MoveDirection.Right;
126 /// }
127 /// }
128 /// }
129 /// ]]>
130 ///</code>
131 /// </example>
132 public enum MoveDirection
133 {
134 /// <summary>
135 /// This is the Left state of MoveDirection. Assign functionality for moving to the left.
136 /// </summary>
137 /// <remarks>
138 /// Use the Left state for an easily identifiable way of moving a GameObject to the left (-1 , 0 , 0). This is a state without any predefined functionality. Before using this state, you should define what your GameObject will do in code.
139 /// </remarks>
140 /// <example>
141 /// <code>
142 /// <![CDATA[
143 /// //Assign this script to a visible GameObject (with a Rigidbody attached) to see this in action
144 ///
145 /// using UnityEngine;
146 /// using UnityEngine.EventSystems;
147 ///
148 /// public class Example : MonoBehaviour
149 /// {
150 /// Vector3 m_StartPosition, m_StartForce;
151 /// Rigidbody m_Rigidbody;
152 /// //Use Enum for easy switching between direction states
153 /// MoveDirection m_MoveDirection;
154 ///
155 /// //Use these Vectors for moving Rigidbody components
156 /// Vector3 m_ResetVector;
157 /// Vector3 m_RightVector;
158 /// const float speed = 5.0f;
159 ///
160 /// void Start()
161 /// {
162 /// //You get the Rigidbody component attached to the GameObject
163 /// m_Rigidbody = GetComponent<Rigidbody>();
164 /// //This starts with the Rigidbody not moving in any direction at all
165 /// m_MoveDirection = MoveDirection.None;
166 ///
167 /// //These are the GameObject’s starting position and Rigidbody position
168 /// m_StartPosition = transform.position;
169 /// m_StartForce = m_Rigidbody.transform.position;
170 ///
171 /// //This Vector is set to 1 in the x axis (for moving in the right direction)
172 /// m_RightVector = Vector3.right;
173 /// //This Vector is zeroed out for when the Rigidbody should not move
174 /// m_ResetVector = Vector3.zero;
175 /// }
176 ///
177 /// void Update()
178 /// {
179 /// //This switches the direction depending on button presses
180 /// switch (m_MoveDirection)
181 /// {
182 /// //The starting state which resets the object
183 /// case MoveDirection.None:
184 /// //Reset to the starting position of the GameObject and Rigidbody
185 /// transform.position = m_StartPosition;
186 /// m_Rigidbody.transform.position = m_StartForce;
187 /// //This resets the velocity of the Rigidbody
188 /// m_Rigidbody.velocity = m_ResetVector;
189 /// break;
190 ///
191 /// //This is for moving left
192 /// case MoveDirection.Left:
193 /// //This moves the Rigidbody to the left (minus right Vector)
194 /// m_Rigidbody.velocity = -m_RightVector * speed;
195 /// break;
196 /// }
197 /// }
198 ///
199 /// void OnGUI()
200 /// {
201 /// //Press the reset Button to switch to no mode
202 /// if (GUI.Button(new Rect(100, 0, 150, 30), "Reset"))
203 /// {
204 /// //Switch to start/reset case
205 /// m_MoveDirection = MoveDirection.None;
206 /// }
207 ///
208 /// //Press the Left button to switch the Rigidbody direction to the left
209 /// if (GUI.Button(new Rect(100, 30, 150, 30), "Move Left"))
210 /// {
211 /// //Switch to the left direction
212 /// m_MoveDirection = MoveDirection.Left;
213 /// }
214 /// }
215 /// }
216 /// ]]>
217 ///</code>
218 /// </example>
219 Left,
220
221 /// <summary>
222 /// This is the Up state of MoveDirection. Assign functionality for moving in an upward direction.
223 /// </summary>
224 /// <remarks>
225 /// Use the Up state for an easily identifiable way of moving a GameObject upwards (0 , 1 , 0). This is a state without any predefined functionality. Before using this state, you should define what your GameObject will do in code.
226 /// </remarks>
227 /// <example>
228 /// <code>
229 /// <![CDATA[
230 /// //Attach this script to a GameObject with a Rigidbody component. Press the "Move Up" button in Game view to see it in action.
231 ///
232 /// using UnityEngine;
233 /// using UnityEngine.EventSystems;
234 ///
235 /// public class Example : MonoBehaviour
236 /// {
237 /// Vector3 m_StartPosition, m_StartForce;
238 /// Rigidbody m_Rigidbody;
239 /// //Use Enum for easy switching between direction states
240 /// MoveDirection m_MoveDirection;
241 ///
242 /// //Use these Vectors for moving Rigidbody components
243 /// Vector3 m_ResetVector;
244 /// Vector3 m_UpVector;
245 /// const float speed = 10.0f;
246 ///
247 /// void Start()
248 /// {
249 /// //You get the Rigidbody component attached to the GameObject
250 /// m_Rigidbody = GetComponent<Rigidbody>();
251 /// //This starts with the Rigidbody not moving in any direction at all
252 /// m_MoveDirection = MoveDirection.None;
253 ///
254 /// //These are the GameObject’s starting position and Rigidbody position
255 /// m_StartPosition = transform.position;
256 /// m_StartForce = m_Rigidbody.transform.position;
257 ///
258 /// //This Vector is set to 1 in the y axis (for moving upwards)
259 /// m_UpVector = Vector3.up;
260 /// //This Vector is zeroed out for when the Rigidbody should not move
261 /// m_ResetVector = Vector3.zero;
262 /// }
263 ///
264 /// void Update()
265 /// {
266 /// //This switches the direction depending on button presses
267 /// switch (m_MoveDirection)
268 /// {
269 /// //The starting state which resets the object
270 /// case MoveDirection.None:
271 /// //Reset to the starting position of the GameObject and Rigidbody
272 /// transform.position = m_StartPosition;
273 /// m_Rigidbody.transform.position = m_StartForce;
274 /// //This resets the velocity of the Rigidbody
275 /// m_Rigidbody.velocity = m_ResetVector;
276 /// break;
277 ///
278 /// //This is for moving in an upwards direction
279 /// case MoveDirection.Up:
280 /// //Change the velocity so that the Rigidbody travels upwards
281 /// m_Rigidbody.velocity = m_UpVector * speed;
282 /// break;
283 /// }
284 /// }
285 ///
286 /// void OnGUI()
287 /// {
288 /// //Press the reset Button to switch to no mode
289 /// if (GUI.Button(new Rect(100, 0, 150, 30), "Reset"))
290 /// {
291 /// //Switch to start/reset case
292 /// m_MoveDirection = MoveDirection.None;
293 /// }
294 ///
295 /// //Press the Up button to switch the Rigidbody direction to upwards
296 /// if (GUI.Button(new Rect(100, 60, 150, 30), "Move Up"))
297 /// {
298 /// //Switch to Up Direction
299 /// m_MoveDirection = MoveDirection.Up;
300 /// }
301 /// }
302 /// }
303 /// ]]>
304 ///</code>
305 /// </example>
306 Up,
307
308 /// <summary>
309 /// This is the Right state of MoveDirection. Assign functionality for moving to the right.
310 /// </summary>
311 /// <remarks>
312 /// Use the Right state for an easily identifiable way of moving a GameObject to the right (1 , 0 , 0). This is a state without any predefined functionality. Before using this state, you should define what your GameObject will do in code.
313 /// </remarks>
314 /// <example>
315 /// <code>
316 /// <![CDATA[
317 /// //Attach this script to a GameObject with a Rigidbody component. Press the "Move Right" button in Game view to see it in action.
318 ///
319 /// using UnityEngine;
320 /// using UnityEngine.EventSystems;
321 ///
322 /// public class MoveDirectionExample : MonoBehaviour
323 /// {
324 /// Vector3 m_StartPosition, m_StartForce;
325 /// Rigidbody m_Rigidbody;
326 /// //Use Enum for easy switching between direction states
327 /// MoveDirection m_MoveDirection;
328 ///
329 /// //Use these Vectors for moving Rigidbody components
330 /// Vector3 m_ResetVector;
331 /// Vector3 m_RightVector;
332 /// const float speed = 5.0f;
333 ///
334 /// void Start()
335 /// {
336 /// //You get the Rigidbody component attached to the GameObject
337 /// m_Rigidbody = GetComponent<Rigidbody>();
338 /// //This starts with the Rigidbody not moving in any direction at all
339 /// m_MoveDirection = MoveDirection.None;
340 ///
341 /// //These are the GameObject’s starting position and Rigidbody position
342 /// m_StartPosition = transform.position;
343 /// m_StartForce = m_Rigidbody.transform.position;
344 ///
345 /// //This Vector is set to 1 in the x axis (for moving in the right direction)
346 /// m_RightVector = Vector3.right;
347 /// //This Vector is zeroed out for when the Rigidbody should not move
348 /// m_ResetVector = Vector3.zero;
349 /// }
350 ///
351 /// void Update()
352 /// {
353 /// //This switches the direction depending on button presses
354 /// switch (m_MoveDirection)
355 /// {
356 /// //The starting state which resets the object
357 /// case MoveDirection.None:
358 /// //Reset to the starting position of the GameObject and Rigidbody
359 /// transform.position = m_StartPosition;
360 /// m_Rigidbody.transform.position = m_StartForce;
361 /// //This resets the velocity of the Rigidbody
362 /// m_Rigidbody.velocity = m_ResetVector;
363 /// break;
364 ///
365 /// //This is for moving right
366 /// case MoveDirection.Right:
367 /// //This moves the Rigidbody to the right
368 /// m_Rigidbody.velocity = m_RightVector * speed;
369 /// break;
370 /// }
371 /// }
372 ///
373 /// void OnGUI()
374 /// {
375 /// //Press the reset Button to switch to no mode
376 /// if (GUI.Button(new Rect(100, 0, 150, 30), "Reset"))
377 /// {
378 /// //Switch to start/reset case
379 /// m_MoveDirection = MoveDirection.None;
380 /// }
381 ///
382 /// //Press the Left button to switch the Rigidbody direction to the right
383 /// if (GUI.Button(new Rect(100, 30, 150, 30), "Move Right"))
384 /// {
385 /// //Switch to the left direction
386 /// m_MoveDirection = MoveDirection.Right;
387 /// }
388 /// }
389 /// }
390 /// ]]>
391 ///</code>
392 /// </example>
393 Right,
394
395 /// <summary>
396 /// The Down State of MoveDirection. Assign functionality for moving in a downward direction.
397 /// </summary>
398 /// <remarks>
399 /// Use the Down state for an easily identifiable way of moving a GameObject downwards (0 , -1 , 0). This is a state without any predefined functionality. Before using this state, you should define what your GameObject will do in code.
400 /// </remarks>
401 /// <example>
402 /// <code>
403 /// <![CDATA[
404 /// //Attach this script to a GameObject with a Rigidbody component. Press the "Move Down" button in Game view to see it in action.
405 ///
406 /// using UnityEngine;
407 /// using UnityEngine.EventSystems;
408 ///
409 /// public class Example : MonoBehaviour
410 /// {
411 /// Vector3 m_StartPosition, m_StartForce;
412 /// Rigidbody m_Rigidbody;
413 /// //Use Enum for easy switching between direction states
414 /// MoveDirection m_MoveDirection;
415 ///
416 /// //Use these Vectors for moving Rigidbody components
417 /// Vector3 m_ResetVector;
418 /// Vector3 m_UpVector;
419 /// const float speed = 10.0f;
420 ///
421 /// void Start()
422 /// {
423 /// //You get the Rigidbody component attached to the GameObject
424 /// m_Rigidbody = GetComponent<Rigidbody>();
425 /// //This starts with the Rigidbody not moving in any direction at all
426 /// m_MoveDirection = MoveDirection.None;
427 ///
428 /// //These are the GameObject’s starting position and Rigidbody position
429 /// m_StartPosition = transform.position;
430 /// m_StartForce = m_Rigidbody.transform.position;
431 ///
432 /// //This Vector is set to 1 in the y axis (for moving upwards)
433 /// m_UpVector = Vector3.up;
434 /// //This Vector is zeroed out for when the Rigidbody should not move
435 /// m_ResetVector = Vector3.zero;
436 /// }
437 ///
438 /// void Update()
439 /// {
440 /// //This switches the direction depending on button presses
441 /// switch (m_MoveDirection)
442 /// {
443 /// //The starting state which resets the object
444 /// case MoveDirection.None:
445 /// //Reset to the starting position of the GameObject and Rigidbody
446 /// transform.position = m_StartPosition;
447 /// m_Rigidbody.transform.position = m_StartForce;
448 /// //This resets the velocity of the Rigidbody
449 /// m_Rigidbody.velocity = m_ResetVector;
450 /// break;
451 ///
452 /// //This is for moving down
453 /// case MoveDirection.Down:
454 /// //This moves the Rigidbody down
455 /// m_Rigidbody.velocity = -m_UpVector * speed;
456 /// break;
457 /// }
458 /// }
459 ///
460 /// void OnGUI()
461 /// {
462 /// //Press the reset Button to switch to no mode
463 /// if (GUI.Button(new Rect(100, 0, 150, 30), "Reset"))
464 /// {
465 /// //Switch to start/reset case
466 /// m_MoveDirection = MoveDirection.None;
467 /// }
468 ///
469 /// //Press the Down button to switch the direction to down
470 /// if (GUI.Button(new Rect(100, 90, 150, 30), "Move Down"))
471 /// {
472 /// //Switch to Down Direction
473 /// m_MoveDirection = MoveDirection.Down;
474 /// }
475 /// }
476 /// }
477 /// ]]>
478 ///</code>
479 /// </example>
480 Down,
481
482 /// <summary>
483 /// This is the None state. Assign functionality that stops movement.
484 /// </summary>
485 /// <remarks>
486 /// Use the None state for an easily identifiable way of stopping, resetting or initialising a GameObject's movement. This is a state without any predefined functionality. Before using this state, you should define what your GameObject will do in code.
487 /// </remarks>
488 /// <example>
489 /// <code>
490 /// <![CDATA[
491 /// //Attach this script to a GameObject with a Rigidbody attached. This script starts off on the ModeDirection.None state but changes depending on buttons you press.
492 ///
493 /// using UnityEngine;
494 /// using UnityEngine.EventSystems;
495 ///
496 /// public class Example : MonoBehaviour
497 /// {
498 /// Vector3 m_StartPosition, m_StartForce;
499 /// Rigidbody m_Rigidbody;
500 /// //Use Enum for easy switching between direction states
501 /// MoveDirection m_MoveDirection;
502 ///
503 /// //Use these Vectors for moving Rigidbody components
504 /// Vector3 m_ResetVector;
505 /// Vector3 m_UpVector;
506 /// const float speed = 10.0f;
507 ///
508 /// void Start()
509 /// {
510 /// //You get the Rigidbody component attached to the GameObject
511 /// m_Rigidbody = GetComponent<Rigidbody>();
512 /// //This starts with the Rigidbody not moving in any direction at all
513 /// m_MoveDirection = MoveDirection.None;
514 ///
515 /// //These are the GameObject’s starting position and Rigidbody position
516 /// m_StartPosition = transform.position;
517 /// m_StartForce = m_Rigidbody.transform.position;
518 ///
519 /// //This Vector is set to 1 in the y axis (for moving upwards)
520 /// m_UpVector = Vector3.up;
521 /// //This Vector is zeroed out for when the Rigidbody should not move
522 /// m_ResetVector = Vector3.zero;
523 /// }
524 ///
525 /// void Update()
526 /// {
527 /// //This switches the direction depending on button presses
528 /// switch (m_MoveDirection)
529 /// {
530 /// //The starting state which resets the object
531 /// case MoveDirection.None:
532 /// //Reset to the starting position of the GameObject and Rigidbody
533 /// transform.position = m_StartPosition;
534 /// m_Rigidbody.transform.position = m_StartForce;
535 /// //This resets the velocity of the Rigidbody
536 /// m_Rigidbody.velocity = m_ResetVector;
537 /// break;
538 ///
539 /// //This is for moving down
540 /// case MoveDirection.Down:
541 /// //This moves the Rigidbody down
542 /// m_Rigidbody.velocity = -m_UpVector * speed;
543 /// break;
544 /// }
545 /// }
546 ///
547 /// void OnGUI()
548 /// {
549 /// //Press the reset Button to switch to no mode
550 /// if (GUI.Button(new Rect(100, 0, 150, 30), "Reset"))
551 /// {
552 /// //Switch to start/reset case
553 /// m_MoveDirection = MoveDirection.None;
554 /// }
555 ///
556 /// //Press the Down button to switch the direction to down
557 /// if (GUI.Button(new Rect(100, 90, 150, 30), "Move Down"))
558 /// {
559 /// //Switch to Down Direction
560 /// m_MoveDirection = MoveDirection.Down;
561 /// }
562 /// }
563 /// }
564 /// ]]>
565 ///</code>
566 /// </example>
567 None
568 }
569}