diff --git a/Assets/Scripts/Backend/Family.cs b/Assets/Scripts/Backend/Family.cs
index dd613bf..e3082cb 100644
--- a/Assets/Scripts/Backend/Family.cs
+++ b/Assets/Scripts/Backend/Family.cs
@@ -8,15 +8,37 @@
*/
namespace Backend
{
+ ///
+ /// Represents a family in the game.
+ ///
public class Family : HouseholdAsset
{
+ ///
+ /// Family name. Family members have this as their last name.
+ ///
public string Name { get; }
+ ///
+ /// List of adults in family.
+ ///
public List Adults { get; } = new List();
+
+ ///
+ /// List of children in family.
+ ///
public List Children { get; } = new List();
+
+ ///
+ /// List of hired workers in the family. Disappear after every year.
+ ///
public List HiredWorkers { get; } = new List();
- //Constructor of the class
+ ///
+ /// Create a new family with adults and children.
+ ///
+ /// Family name.
+ /// Number of children.
+ /// Number of adults.
public Family(string FamilyName, int NumChildren, int numAdults)
{
Name = FamilyName;
@@ -30,8 +52,11 @@ public Family(string FamilyName, int NumChildren, int numAdults)
}
}
- // Add a new child to the family
- // If age is -1, then generate random age between 0 and 13
+ ///
+ /// Add a new child to the family.
+ /// If is -1, then generate random age between 0 and 13 (exclusive).
+ ///
+ /// Age.
public void CreateChild(int age = -1)
{
age = age == -1 ? Random.Range(0, 13) : age;
@@ -39,36 +64,55 @@ public void CreateChild(int age = -1)
Children.Add(child);
}
+ ///
+ /// Add a new adult to the family.
+ ///
public void CreateAdult()
{
Adult adult = new Adult(FamilyMember.GetRandomFirstName(), Name);
Adults.Add(adult);
}
- //Calculate family's total consumption after each year
+ ///
+ /// Calculate family's total wheat consumption for the year.
+ ///
+ /// Family's total wheat consumption for the year.
public int GetTotalConsumption()
{
return Children.Count * Child.Consumption + Adults.Count * Adult.Consumption;
}
- // Count the amount of adults
+ ///
+ /// Get the number of adults in the family.
+ ///
+ /// The number of adults in the family.
public int GetAdultAmount()
{
return Adults.Count();
}
- // Count the amount of children
+ ///
+ /// Get the number of children in the family.
+ ///
+ /// The number of children in the family.
public int GetChildrenAmount()
{
return Children.Count();
}
+ ///
+ /// Get the number of hired workers in the family.
+ ///
+ /// The number of hired workers in the family.
public int GetHiredWorkerAmount()
{
return HiredWorkers.Count();
}
- // Get total labour points that this family can give
+ ///
+ /// Get the total number of labour points that the family generates.
+ ///
+ /// The total number of labour points that the family generates.
public int GetLabourPoints()
{
int adult_point = Adults.Aggregate(0, (sum, adult) => sum + adult.GetLabourPoints());
diff --git a/Assets/Scripts/Components/ProductAmountDisplayer.cs b/Assets/Scripts/Components/ProductAmountDisplayer.cs
index 34bc267..30d9c80 100644
--- a/Assets/Scripts/Components/ProductAmountDisplayer.cs
+++ b/Assets/Scripts/Components/ProductAmountDisplayer.cs
@@ -3,7 +3,9 @@
using UnityEngine;
// Original Author: Andy Wang
-// Displays how many of a certain product you have in your inventory
+///
+/// Makes a text component display how many of a given product you have in your inventory based on a format string.
+///
public class ProductAmountDisplayer : MonoBehaviour
{
[SerializeField] string productName;
diff --git a/Assets/Scripts/Components/ProductDescriptionDisplayer.cs b/Assets/Scripts/Components/ProductDescriptionDisplayer.cs
index a2402b6..1dd6616 100644
--- a/Assets/Scripts/Components/ProductDescriptionDisplayer.cs
+++ b/Assets/Scripts/Components/ProductDescriptionDisplayer.cs
@@ -3,7 +3,9 @@
using UnityEngine;
// Original Author: Andy Wang
-// Display a product's description as it is registered in the shop
+///
+/// Make a text component dislay the description of a given product in the market.
+///
public class ProductDescriptionDisplayer : MonoBehaviour
{
[SerializeField] string productName;
diff --git a/Assets/Scripts/Components/ProductPriceDisplayer.cs b/Assets/Scripts/Components/ProductPriceDisplayer.cs
index 2c3cd43..e329ea3 100644
--- a/Assets/Scripts/Components/ProductPriceDisplayer.cs
+++ b/Assets/Scripts/Components/ProductPriceDisplayer.cs
@@ -3,7 +3,9 @@
using UnityEngine;
// Original Author: Andy Wang
-// Display a product's price as it is registered in the shop
+///
+/// Make a text component display the price of a product in the market given a format string.
+///
public class ProductPriceDisplayer : MonoBehaviour
{
[SerializeField] string productName;
diff --git a/Assets/Scripts/Components/SceneUtils.cs b/Assets/Scripts/Components/SceneUtils.cs
index 5e5078f..6a9bbf5 100644
--- a/Assets/Scripts/Components/SceneUtils.cs
+++ b/Assets/Scripts/Components/SceneUtils.cs
@@ -1,10 +1,15 @@
using UnityEngine;
using UnityEngine.SceneManagement;
-// Helper functions related to scene loading
+///
+/// Helper functions for scene loading. Mostly a wrapper around Unity's SceneManager.
+///
public class SceneUtils: MonoBehaviour
{
- // Load the given scene and reset the appropriate static variables
+ ///
+ /// Load the given scene and reset any static variables where appropriate.
+ ///
+ /// The name of the scene to load.
public static void LoadScene(string sceneName) {
// Reset any appropriate static variables if needed here
SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
diff --git a/Assets/Scripts/Components/SellButton.cs b/Assets/Scripts/Components/SellButton.cs
index d67941b..865a1e2 100644
--- a/Assets/Scripts/Components/SellButton.cs
+++ b/Assets/Scripts/Components/SellButton.cs
@@ -2,6 +2,9 @@
using UnityEngine;
using UnityEngine.UI;
+///
+/// Make a button component sell a product from your inventory and gives you money.
+///
public class SellButton : MonoBehaviour
{
[SerializeField] int num;
@@ -25,6 +28,9 @@ void Update()
_btn.interactable = GameState.s_Player.Inventory.GetAmount(productName) > 0;
}
+ ///
+ /// Click handler.
+ ///
public void OnClick()
{
Market.Sell(GameState.s_Player, num, productName);
diff --git a/Assets/Scripts/Components/ShowFamilyMembers.cs b/Assets/Scripts/Components/ShowFamilyMembers.cs
index 11e4021..31a64a2 100644
--- a/Assets/Scripts/Components/ShowFamilyMembers.cs
+++ b/Assets/Scripts/Components/ShowFamilyMembers.cs
@@ -3,6 +3,9 @@
using UnityEngine;
// author: Jacqueline Zhu
+///
+/// Makes a text component show a summary of your family members.
+///
public class ShowFamilyMembers : MonoBehaviour
{
diff --git a/Assets/Scripts/Components/ShowPopupOnClick.cs b/Assets/Scripts/Components/ShowPopupOnClick.cs
index ead5a2d..a829144 100644
--- a/Assets/Scripts/Components/ShowPopupOnClick.cs
+++ b/Assets/Scripts/Components/ShowPopupOnClick.cs
@@ -2,7 +2,9 @@
using UnityEngine.UI;
// Original Author: Andy Wang
-// Upon click, show a popup containing text
+///
+/// Make a button component show a popup on click given various serialized fields customizing the popup.
+///
public class ShowPopupOnClick : MonoBehaviour
{
[SerializeField] string title;
diff --git a/Assets/Scripts/Components/ShowWheatPrice.cs b/Assets/Scripts/Components/ShowWheatPrice.cs
index 54b7384..d1a282e 100644
--- a/Assets/Scripts/Components/ShowWheatPrice.cs
+++ b/Assets/Scripts/Components/ShowWheatPrice.cs
@@ -1,8 +1,15 @@
using UnityEngine;
using TMPro;
using Backend;
+
+///
+/// Make a text component show current year's wheat price.
+///
public class ShowWheatPrice : MonoBehaviour
{
+ ///
+ /// The text component to modify.
+ ///
public TextMeshProUGUI wheatPriceText;
[SerializeField] string text;
diff --git a/Assets/Scripts/Components/ShowYieldTable.cs b/Assets/Scripts/Components/ShowYieldTable.cs
index 179e8bc..5ed0a55 100644
--- a/Assets/Scripts/Components/ShowYieldTable.cs
+++ b/Assets/Scripts/Components/ShowYieldTable.cs
@@ -1,6 +1,9 @@
using UnityEngine;
using UnityEngine.UI;
+///
+/// Unused.
+///
public class ShowYieldTable : MonoBehaviour
{
public Image yieldTable;
diff --git a/Assets/Scripts/Components/TabToggler.cs b/Assets/Scripts/Components/TabToggler.cs
index 0e31e9e..2db7d05 100644
--- a/Assets/Scripts/Components/TabToggler.cs
+++ b/Assets/Scripts/Components/TabToggler.cs
@@ -3,7 +3,9 @@
using UnityEngine.UI;
// Authors: Kevin, Andy
-// Turn a button into a toggle for another UI element
+///
+/// Unused.
+///
public class TabToggler : MonoBehaviour
{
[SerializeField] GameObject tab;
diff --git a/Assets/Scripts/Components/ToggleIfHasProduct.cs b/Assets/Scripts/Components/ToggleIfHasProduct.cs
index 05c6c3e..690bcf0 100644
--- a/Assets/Scripts/Components/ToggleIfHasProduct.cs
+++ b/Assets/Scripts/Components/ToggleIfHasProduct.cs
@@ -3,7 +3,9 @@
using UnityEngine.UI;
// Original Author: Andy Wang
-// Enable/disable a toggle based on if you have some of an inventory item
+///
+/// Enable or disable a Toggle component depending on if you have a given product in your inventory.
+///
public class ToggleIfHasProduct : MonoBehaviour
{
[SerializeField] string productName;
diff --git a/Assets/Scripts/Components/ToolToggle.cs b/Assets/Scripts/Components/ToolToggle.cs
index b62c00d..befa7c4 100644
--- a/Assets/Scripts/Components/ToolToggle.cs
+++ b/Assets/Scripts/Components/ToolToggle.cs
@@ -4,7 +4,9 @@
using UnityEngine.UI;
// Original Author: Andy Wang
-// For selecting a tool with which to click on farm cells
+///
+/// A toggle for selecting which tool to use during Phase 3.
+///
public class ToolToggle : MonoBehaviour
{
[SerializeField] string toolName;
diff --git a/Assets/Scripts/Components/UIDocumentLoadSceneButton.cs b/Assets/Scripts/Components/UIDocumentLoadSceneButton.cs
index 9f11827..499dc98 100644
--- a/Assets/Scripts/Components/UIDocumentLoadSceneButton.cs
+++ b/Assets/Scripts/Components/UIDocumentLoadSceneButton.cs
@@ -3,8 +3,10 @@
using UnityEngine.UIElements;
// Original Author: Andy Wang
-// Put this on a UIDocument with buttons in it
-// This script makes it so all the buttons with class "load-scene-button" load a scene upon click
+///
+/// Put this on a UIDocument with buttons in it.
+/// This script makes it so all the buttons with class "load-scene-button" load a scene upon click.
+///
public class UIDocumentLoadSceneButton : MonoBehaviour
{
private UIDocument _uiDocument;