teleias

Basic Breakdown of CSc191 code structure

Dec 5th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. Attack Visualizer
  2. Awake:
  3. Creates singleton
  4. ***_Prefab:
  5. Some cached Resource.Loads
  6. Attack:
  7. Attack creates coroutine AttackIE
  8. AttackIE:
  9. Coroutine (runs async)
  10. Randomizes the start location slightly ->
  11. Creates a projectile ->
  12. Colors projectile according to preferences ->
  13. Sends point data to projectile ->
  14. Waits for projectile to hit ->
  15. Creates attack ping at endpoint ->
  16. Creates explosion at endpoint ->
  17. Cleans up created gameObjects
  18. Console
  19. Controls user input, hooks into [InputLog] and [Timer]
  20.  
  21. InputLog
  22. Implements 'Timed' interface.
  23. On Awake:
  24. Creates singleton
  25. Finds UI.Text
  26. Begins UpdateTicker coroutine
  27. On Start:
  28. Registers ticker
  29. SetupReader:
  30. Coroutine (runs async)
  31. Loop ->
  32. Batches the next 100 attacks together ->
  33. Takes their IPs and puts them in a list ->
  34. Feeds list of IPs into Python ->
  35. Takes the Lat/Lon from Python and place back into corresponding attack ->
  36. Places all attacks into Dictionary<Time, List<Attack>>
  37. Stops when it has buffered a full minute ahead of current Time
  38. Tick:
  39. Tick creates coroutine TickIE
  40. TickIE:
  41. Coroutine (runs async)
  42. Takes in the current time
  43. Removes List<Attack> value according to Time key
  44. For each Attack in list:
  45. Displays Log data in one of two formats onto screen
  46. Calls AttackVisualizer to visualize the attack
  47. UpdateTicker:
  48. Coroutine (runs async)
  49. Makes sure Logger doesn't overflow.
  50.  
  51. GetGeoLocation
  52. { ... }
  53.  
  54. LatLong
  55. Mostly deprecated
  56. Functions are mostly library-like, so public static.
  57. Convert:
  58. Converts a Lat/Lon value into a scaled normalized XYZ
  59. GetPoints:
  60. Converts attack into a start/mid/end triplet
  61. DrawAttackLine:
  62. Used only for testing
  63.  
  64. Projectile
  65. Creates a visual projectile
  66. Init:
  67. Inputs as arguments the path for projectile to take
  68. Sets up some internal values such as tint color, trail width
  69. Update:
  70. Ticks projectile along its path using a parabolic path predetermined by start/mid/end triplet
  71. Destroys object after hitting
  72.  
  73.  
  74. Timer
  75. The central time-keeper, it also informs all Timed interfaces about changes in time.
  76. Awake:
  77. Finds the UI.Text
  78. Play:
  79. Sets delta to 1
  80. Pause:
  81. Sets delta to 0
  82. SetSpeed:
  83. Sets delta to arg
  84. SetTime:
  85. Sets time
  86. Start:
  87. Coroutine (runs async)
  88. Loop ->
  89. Inform all Timed interfaces about current time.
  90. Update current time by 1 or -1, given by Mathf.sign(delta)
  91. Wait for 1 / delta seconds.
  92. Special case: won't allow divby0
  93. 1 / delta makes it tick every 0.5s if delta is 2, or 0.25s if delta is 4, etc
  94. TickAll:
  95. Informs all registered Timed interfaces of updates to time
Advertisement
Add Comment
Please, Sign In to add comment