@@ -18,16 +18,32 @@ public class PlayerInputController : MonoBehaviour
1818
1919 private Camera _mainCam ;
2020
21+ /// <summary>
22+ /// Initializes a reference to the main camera for further use.
23+ /// </summary>
2124 void Start ( )
2225 {
2326 _mainCam = Camera . main ;
2427 }
2528
29+ /// <summary>
30+ /// Calls the main method.
31+ /// </summary>
2632 void Update ( )
2733 {
2834 MouseClicks ( ) ;
2935 }
3036
37+ /// <summary>
38+ /// The main method of the PlayerInputController. It handles left-click, right-click and drag select.
39+ /// </summary>
40+ /// <remarks>A single left mouse click marks a single unit.
41+ /// Pressing down the left mouse marks a corner for the drag box, releasing it marks the other. While the mouse
42+ /// is being pressed the dragbox changes its visual dimension. This has no effect on the select functionality.
43+ /// The controller has a list of all currently existing player units and then searches that list for units inside the drag box.
44+ /// With a right click the controlled units are send somewhere. The controller differentiates between a right-click
45+ /// on an enemy, an own unit, the enemy base, the own base and a click on open ground and acts accordingly.
46+ /// There are plenty of comments inside that code that mark the beginnings of the different sections.</remarks>
3147 private void MouseClicks ( )
3248 {
3349 // left mouse click
@@ -151,11 +167,19 @@ private void MouseClicks()
151167
152168 }
153169
170+ /// <summary>
171+ /// Adds a unit the list of currently controlled units.
172+ /// </summary>
173+ /// <param name="unit">The unit that should be added to the list.</param>
154174 public void AddActiveUnit ( Unit unit )
155175 {
156176 _activeUnits . Add ( unit ) ;
157177 }
158178
179+ /// <summary>
180+ /// Removes a unit the list of currently controlled units.
181+ /// </summary>
182+ /// <param name="unit">The unit that should be removed from the list.</param>
159183 public void RemoveActiveUnit ( Unit unit )
160184 {
161185 _activeUnits . Remove ( unit ) ;
0 commit comments