Skip to content

Commit 2d68e64

Browse files
committed
Update comment formatting
1 parent 4db351b commit 2d68e64

File tree

4 files changed

+37
-45
lines changed

4 files changed

+37
-45
lines changed

Assets/Scripts/Asteroid.cs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
public class Asteroid : MonoBehaviour
1010
{
1111
/// <summary>
12-
/// An array of sprites of which one is randomly
13-
/// assigned to the asteroid.
12+
/// An array of sprites of which one is randomly assigned to the asteroid.
1413
/// </summary>
1514
[Tooltip("An array of sprites of which one is randomly assigned to the asteroid.")]
1615
public Sprite[] sprites;
@@ -40,8 +39,8 @@ public class Asteroid : MonoBehaviour
4039
public float movementSpeed = 50.0f;
4140

4241
/// <summary>
43-
/// The maximum amount of time the asteroid can
44-
/// stay alive after which it is destroyed.
42+
/// The maximum amount of time the asteroid can stay alive after which it is
43+
/// destroyed.
4544
/// </summary>
4645
[Tooltip("The maximum amount of time the asteroid can stay alive after which it is destroyed.")]
4746
public float maxLifetime = 30.0f;
@@ -81,8 +80,7 @@ private void Start()
8180

8281
public void SetTrajectory(Vector2 direction)
8382
{
84-
// Move the asteroid along the trajectory
85-
// factoring in its speed
83+
// Move the asteroid along the trajectory factoring in its speed
8684
_rigidbody.AddForce(direction * this.movementSpeed);
8785
}
8886

@@ -91,33 +89,31 @@ private void OnCollisionEnter2D(Collision2D collision)
9189
// Check if the asteroid was hit by a bullet
9290
if (collision.gameObject.tag == "Bullet")
9391
{
94-
// Check if the asteroid is large enough to
95-
// split in half (both parts must be greater
96-
// than the minimum size)
92+
// Check if the asteroid is large enough to split in half (both
93+
// parts must be greater than the minimum size)
9794
if ((this.size * 0.5f) >= this.minSize)
9895
{
99-
// Split the asteroid into two parts
100-
// by creating two new asteroids
96+
// Split the asteroid into two parts by creating two new
97+
// asteroids
10198
CreateSplit();
10299
CreateSplit();
103100
}
104101

105-
// Inform the game manager the asteroid
106-
// was destroyed so score can be calculated
102+
// Inform the game manager the asteroid was destroyed so score can
103+
// be calculated
107104
FindObjectOfType<GameManager>().AsteroidDestroyed(this);
108105

109-
// Destroy the current asteroid since it is
110-
// either replaced by two new asteroid objects
111-
// or small enough to be destroyed by the bullet
106+
// Destroy the current asteroid since it is either replaced by two
107+
// new asteroid objects or small enough to be destroyed by the
108+
// bullet
112109
Destroy(this.gameObject);
113110
}
114111
}
115112

116113
private Asteroid CreateSplit()
117114
{
118-
// Set the new asteroid poistion to be the same
119-
// as the current asteroid but with a slight offset
120-
// so they do not spawn inside each other
115+
// Set the new asteroid poistion to be the same as the current asteroid
116+
// but with a slight offset so they do not spawn inside each other
121117
Vector2 position = this.transform.position;
122118
position += Random.insideUnitCircle * 0.5f;
123119

Assets/Scripts/AsteroidSpawner.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using UnityEngine;
22

33
/// <summary>
4-
/// Continuously spawns asteroids and sets their
5-
/// initial trajectory.
4+
/// Continuously spawns asteroids and sets their initial trajectory.
65
/// </summary>
76
public class AsteroidSpawner : MonoBehaviour
87
{
@@ -31,8 +30,8 @@ public class AsteroidSpawner : MonoBehaviour
3130
public int amountPerSpawn = 1;
3231

3332
/// <summary>
34-
/// The maximum angle in degrees the asteroid will
35-
/// steer from its initial trajectory.
33+
/// The maximum angle in degrees the asteroid will steer from its initial
34+
/// trajectory.
3635
/// </summary>
3736
[Tooltip("The maximum angle in degrees the asteroid will steer from its initial trajectory.")]
3837
[Range(0.0f, 45.0f)]
@@ -48,22 +47,22 @@ public void Spawn()
4847
{
4948
for (int i = 0; i < this.amountPerSpawn; i++)
5049
{
51-
// Choose a random direction from the center of the spawner
52-
// and spawn the asteroid a distance away
50+
// Choose a random direction from the center of the spawner and
51+
// spawn the asteroid a distance away
5352
Vector2 spawnDirection = Random.insideUnitCircle.normalized;
5453
Vector3 spawnPoint = spawnDirection * this.spawnDistance;
5554

56-
// Offset the spawn point by the position of the spawner
57-
// so its relative to the spawner location
55+
// Offset the spawn point by the position of the spawner so its
56+
// relative to the spawner location
5857
spawnPoint += this.transform.position;
5958

60-
// Calculate a random variance in the asteroid's rotation
61-
// which will cause its trajectory to change
59+
// Calculate a random variance in the asteroid's rotation which will
60+
// cause its trajectory to change
6261
float variance = Random.Range(-this.trajectoryVariance, this.trajectoryVariance);
6362
Quaternion rotation = Quaternion.AngleAxis(variance, Vector3.forward);
6463

65-
// Create the new asteroid by cloning the prefab
66-
// and set a random size within the range
64+
// Create the new asteroid by cloning the prefab and set a random
65+
// size within the range
6766
Asteroid asteroid = Instantiate(this.asteroidPrefab, spawnPoint, rotation);
6867
asteroid.size = Random.Range(asteroid.minSize, asteroid.maxSize);
6968

Assets/Scripts/Bullet.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using UnityEngine;
22

33
/// <summary>
4-
/// Handles the physics/movement of a bullet
5-
/// projectile.
4+
/// Handles the physics/movement of a bullet projectile.
65
/// </summary>
76
[RequireComponent(typeof(Rigidbody2D))]
87
[RequireComponent(typeof(BoxCollider2D))]
@@ -15,8 +14,8 @@ public class Bullet : MonoBehaviour
1514
public float speed = 500.0f;
1615

1716
/// <summary>
18-
/// The maximum amount of time the bullet will
19-
/// stay alive after being projected.
17+
/// The maximum amount of time the bullet will stay alive after being
18+
/// projected.
2019
/// </summary>
2120
[Tooltip("The maximum amount of time the bullet will stay alive after being projected.")]
2221
public float maxLifetime = 10.0f;
@@ -34,8 +33,8 @@ private void Awake()
3433

3534
public void Project(Vector2 direction)
3635
{
37-
// Move the bullet in the desired direction
38-
// while factoring in the speed of the bullet
36+
// Move the bullet in the desired direction while factoring in the speed
37+
// of the bullet
3938
_rigidbody.AddForce(direction * this.speed);
4039

4140
// Destroy the bullet after it reaches its max lifetime

Assets/Scripts/GameManager.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
using UnityEngine.UI;
33

44
/// <summary>
5-
/// Manages the state of the game, such as
6-
/// scoring, dying, and starting a new game.
5+
/// Manages the state of the game, such as scoring, dying, and starting a new
6+
/// game.
77
/// </summary>
88
public class GameManager : MonoBehaviour
99
{
@@ -14,8 +14,8 @@ public class GameManager : MonoBehaviour
1414
public Player player;
1515

1616
/// <summary>
17-
/// The particle effect that is played when an
18-
/// asteroid is destroyed and when the player dies.
17+
/// The particle effect that is played when an asteroid is destroyed and
18+
/// when the player dies.
1919
/// </summary>
2020
[Tooltip("The particle effect that is played when an asteroid is destroyed and when the player dies.")]
2121
public ParticleSystem explosionEffect;
@@ -82,8 +82,7 @@ public void NewGame()
8282

8383
public void Respawn()
8484
{
85-
// Move the player back to the center
86-
// and reactivate their controls
85+
// Move the player back to the center and reactivate their controls
8786
this.player.transform.position = Vector3.zero;
8887
this.player.gameObject.SetActive(true);
8988
}
@@ -106,8 +105,7 @@ public void AsteroidDestroyed(Asteroid asteroid)
106105

107106
public void PlayerDeath(Player player)
108107
{
109-
// Play the explosion effect at the
110-
// location of the player
108+
// Play the explosion effect at the location of the player
111109
this.explosionEffect.transform.position = player.transform.position;
112110
this.explosionEffect.Play();
113111

0 commit comments

Comments
 (0)