diff --git a/Assets/Source/Scripts/Pong/Ball/PongBall.cs b/Assets/Source/Scripts/Pong/Ball/PongBall.cs
index 42b4d53..cce1f8f 100644
--- a/Assets/Source/Scripts/Pong/Ball/PongBall.cs
+++ b/Assets/Source/Scripts/Pong/Ball/PongBall.cs
@@ -1,4 +1,10 @@
//namespace Pong.Ball;
+/*
+This file is important because it handles aspects of the ball to make sure it functions properly. This includes when the balls scores, the ball velocity, and the serves
+The method serve is important in this file. It serves the ball to the correct side at a random angle.
+The method reset is important. It resets the ball's position.
+The method DestroyBall is important. This makes the ball "dissappear" once it goes off the screen into the goal.
+*/
using Pong.Ball;
using System;
@@ -114,6 +120,10 @@ public void Initialize(Player server) {
}
// serve the ball
+///
+/// It serves the ball to the correct side at a random angle.
+///
+/// void, doesnt return anything
public void Serve() {
(float angle, bool serverDesire) = serveAngles.Pop();
float speed = BALL_SPEED_VP; // in terms of viewport x percentage
@@ -133,12 +143,18 @@ public void Serve() {
public void Update() {
//TODO: feed to players?
}
-
+///
+/// This makes the ball "dissappear" once it goes off the screen into the goal.
+///
+/// void, doesnt return anything
public void DestroyBall() {
ballSprite.gameObj.SetActive(false);
ballSprite.controller.HaltTrajectory(); // stop the ball from going off the screen
}
-
+///
+/// It resets the ball's position.
+///
+/// void, doesnt return anything
public void Reset() {
// set position to start position
ballSprite.transform.localPosition = GetStartLocalPosition();
diff --git a/Assets/Source/Scripts/Pong/Ball/PongBallController.cs b/Assets/Source/Scripts/Pong/Ball/PongBallController.cs
index 6188b00..927072b 100644
--- a/Assets/Source/Scripts/Pong/Ball/PongBallController.cs
+++ b/Assets/Source/Scripts/Pong/Ball/PongBallController.cs
@@ -1,4 +1,10 @@
//namespace Pong.Ball;
+/*
+This file is very important due to the abilities it gives the pong ball. This file handles all of the physics behind the ball in order for it to work properly on the screen.
+The method awake is simple but important. This allows the velocity and all the derivatives of the ball to be set to 0.
+The method RetrieveBallTrajectory is important. This allows the code to capture the velocity and vector of the ball.
+The method moveLocal is important. This allows the code to deal with movement, collision, and interactions as a result of that movement.
+*/
using Pong.Ball;
using System;
@@ -40,7 +46,10 @@ public void Initialize(Action scoreProcedure, Action reboundProcedure) {
isInitialized = true;
}
-
+///
+/// This allows the velocity and all the derivatives of the ball to be set to 0.
+///
+/// void, doesnt return anything
void Awake()
{
// cancel motion: no more velocity and further derivatives! all 0
@@ -72,6 +81,10 @@ void Update()
}
//* Deals with Movement, and Collision + Interactions as a Result of that movement
+///
+/// This allows the code to deal with movement, collision, and interactions as a result of that movement.
+///
+/// void, doesnt return anything
public void MoveLocal(Vector3 localDelta_dt) {
// origin is in the center
Vector3 MAX_POS = BG_TRANSFORM.localScale / 2f;
@@ -172,6 +185,10 @@ public void SetFreeze(bool freeze) {
// [(x, y), (x', y'), (x'', y''), ...]
// in terms of viewport %
+///
+/// This allows the code to capture the velocity and vector of the ball.
+///
+/// returns a vector of the ball
public Vector2[] RetrieveBallTrajectory() {
Vector2 vpLocalPos = ToViewport(transform.localPosition);
diff --git a/Assets/Source/Scripts/Pong/Ball/_Pong-Ball.cs b/Assets/Source/Scripts/Pong/Ball/_Pong-Ball.cs
index 44ec914..f0dbd7b 100644
--- a/Assets/Source/Scripts/Pong/Ball/_Pong-Ball.cs
+++ b/Assets/Source/Scripts/Pong/Ball/_Pong-Ball.cs
@@ -1,11 +1,18 @@
// * NAMESPACE HEADER FILE
-
+/*
+Important for the pong ball logic and physics to work properly in the game.
+The class PongBall in this file is extremely important; it handles how the velocity and collisions work with the ball
+The class PongBallController in this file is extremely important; it holds the functionality of the actual goals when the ball scores in goal
+The class BallGoal in this file is extremely important; it holds the boolean values for the left and right goal
+*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pong;
-
+///
+/// Handles the velocity and collisions with the ball.
+///
namespace Pong.Ball {
/*
* Player lastTouchedBy
@@ -36,7 +43,9 @@ public static bool IsGoal(int ballStatus) {
return Mathf.Abs(ballStatus) == GOAL;
}
}*/
-
+///
+/// When ball scores in a goal, it sets the left one to true and right one to false, allowing the code to operate smoothly with this ideology.
+///
public static class BallGoal {
public const bool LEFT = true;
public const bool RIGHT = false;
diff --git a/Assets/Source/Scripts/Pong/GamePlayer/Player.cs b/Assets/Source/Scripts/Pong/GamePlayer/Player.cs
index 4d60f5d..e3a6792 100644
--- a/Assets/Source/Scripts/Pong/GamePlayer/Player.cs
+++ b/Assets/Source/Scripts/Pong/GamePlayer/Player.cs
@@ -1,4 +1,10 @@
//namespace Pong.GamePlayer;
+/*
+This file is very important for the overall program to work. This file allows the paddles to work. This file also collects data from the player, which will come into use fo rthe AI.
+The method CreateNew is important in this file. This creates the paddles, as well as allows the users to set the name of the players.
+The method update also seems very important. It looks like it updates the velocity and acceleration of the paddles.
+The method SetLocalPaddleDimensionsFromVP is important. It sets the dimensions of the paddles and allows them to actually operate with those dimensions.
+*/
using Pong.GamePlayer;
using System.Collections;
@@ -53,7 +59,10 @@ public Player(PlayerData playerData, GameObject sprite, PlayerControls controls,
// wrap it up
playerSprite = new ControlledGameObject(sprite, controller);
}
-
+///
+/// This creates the paddles, as well as allows the users to set the name of the players.
+///
+/// returns the Player class with the values for the current player
public static Player CreateNew(string name, GameObject prefab, Vector2 viewportPos, PlayerControls controls, TMP_Text scoreText) {
// create paddle
GameObject paddle = GameObject.Instantiate(prefab, ToLocal(viewportPos), Quaternion.identity);
@@ -84,7 +93,10 @@ public Player Opponent {
get { return opponent; }
set { opponent = value; }
}
-
+///
+/// It looks like it updates the velocity and acceleration of the paddles.
+///
+/// void, doesn't return anything
public void Update() {
forceMap.PaddleVelocity = ToLocal(playerSprite.controller.GetViewportMotionTracker().velocity).y;
forceMap.PaddleAcceleration = ToLocal(new Vector2(0f, playerSprite.controller.GetViewportMotionTracker().Y_Acceleration)).y;
@@ -104,7 +116,10 @@ public void ScorePoint() {
public Rebounder AsRebounder() {
return new Rebounder(forceMap, playerSprite.gameObj.GetComponent());
}
-
+///
+/// It sets the dimensions of the paddles and allows them to actually operate with those dimensions.
+///
+/// void, doesn't return anything
public void SetLocalPaddleDimensionsFromVP(float vpXThickness, float vpYLength) {
Vector3 bgScale = GameCache.BG_TRANSFORM.localScale;
diff --git a/Assets/Source/Scripts/Pong/GamePlayer/_Pong-GamePlayer.cs b/Assets/Source/Scripts/Pong/GamePlayer/_Pong-GamePlayer.cs
index f92133c..68ef6f1 100644
--- a/Assets/Source/Scripts/Pong/GamePlayer/_Pong-GamePlayer.cs
+++ b/Assets/Source/Scripts/Pong/GamePlayer/_Pong-GamePlayer.cs
@@ -1,9 +1,17 @@
// * NAMESPACE HEADER FILE
-
+/*
+Important for the player controls and data to work properly.
+The class PlayerControls in this file is extremely important; it holds the controls for the player to use (input for the game)
+The class PlayerData in this file is extremely important; it holds the player data (which will probably be used for the AI)
+The class PlayerController in this file is extremely important; it holds the behavior type for the controller
+*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
+///
+/// Holds controls for the player to use (up and down), holds the player data in this file for the AI, and also holds the behavior type for the controller.
+///
namespace Pong.GamePlayer {
public partial class Player {}
diff --git a/Assets/Source/Scripts/Pong/_Pong.cs b/Assets/Source/Scripts/Pong/_Pong.cs
index 699b313..c307608 100644
--- a/Assets/Source/Scripts/Pong/_Pong.cs
+++ b/Assets/Source/Scripts/Pong/_Pong.cs
@@ -1,5 +1,15 @@
// * NAMESPACE HEADER FILE
-
+/*
+Important for the actual constants for the game to be stored and inputed somewhere. Also makes sure the game just functions properly.
+The class GameConstants in this file is extremely important; it holds the constants of the game, such as the max score, and score to win
+The class GameCache in this file is extremely important; it holds the context that is passed into GameManager (GameManager sets them)
+The class GameHelpers in this file is extremely important; it creates the vectors and viewports for the code
+
+THREE CHANGES:
+Changed the win score for pong from 11 to 10. This made it so that it is the first person to 10 to win instead of 11.
+Changed the max ball y derivative from 3 to 10. This allowed the ball to travel faster in the y dimension.
+Changed the ball scale y from .05 to .1. This made the ball bigger
+*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -7,18 +17,21 @@
using Pong.GamePlayer;
namespace Pong {
+///
+/// Sets all of the constants for the game.
+///
public static class GameConstants {
// must be >= 1 because velocity is required
- public const uint BALL_Y_MAX_DERIVATIVE = 3; // velocity + (acceleration, acceleration')
+ public const uint BALL_Y_MAX_DERIVATIVE = 10; // velocity + (acceleration, acceleration')
public const uint MAX_SCORE = 999; // any more than that and the UI kinda clips
- public const uint DEFAULT_WIN_SCORE = 11; // 11 points is a win in the original Pong game!
+ public const uint DEFAULT_WIN_SCORE = 10; // 11 points is a win in the original Pong game!
// used for abnormal shots
public const float PADDLE_MASS = 1.00f;
// viewport y
- public const float BALL_SCALE_Y = 0.05f;
+ public const float BALL_SCALE_Y = 0.1f;
// constants for if origin of a viewport is in the middle of the screen
public const float CENTER_ORIGIN_X = 0.5f;
@@ -39,6 +52,9 @@ public static class GameConstants {
public static readonly char[] WINDOWS_BANNED_CHARS = {'\\', '/', ':', '*', '?', '\"', '<', '>', '|'};
}
+///
+/// Sets the context passed into GameManager and set by it.
+///
public static class GameCache {
// cached at the beginning of GameManager
@@ -55,6 +71,9 @@ public static class GameCache {
public static bool MUTE_SOUNDS = false; // when turned on, audio won't be played
}
+///
+/// Sets vectors for the game to use.
+///
public static class GameHelpers {
public static Vector2 ToVector2(Vector3 vector) {
return new Vector2(vector.x, vector.y);