From 00a80bd1ae18b6609e90648a564978e5bf1094fe Mon Sep 17 00:00:00 2001 From: WyattHolliday Date: Mon, 22 Apr 2024 17:18:22 -0700 Subject: [PATCH] Updated documentation --- docs/src/cell.md | 2 +- docs/src/main_menu_button.md | 2 +- docs/src/nutrient_zone.md | 48 ++++++++++++++++++++++++++++++++++++ docs/src/reset_button.md | 2 +- docs/src/stats_counter.md | 2 +- docs/src/time_counter.md | 2 +- 6 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 docs/src/nutrient_zone.md diff --git a/docs/src/cell.md b/docs/src/cell.md index 8478729..d6fbf9d 100644 --- a/docs/src/cell.md +++ b/docs/src/cell.md @@ -31,7 +31,7 @@ Description: The Cell object represents a biological cell within a simulation. I - void setImmortal(bool isImmortal): sets the global variable immortal to the given value - void _ready() override: runs once when the Cell has been created and is ready to be used; points _cellState to this Cell's CellState Node -- void _process(double delta) override: runs once per in-game frame; delta stores the real time since the last frame; simulates CellStructure activation and Cell aging, starvation, and death +- void _process(double delta) override: runs once per in-game frame; delta stores the real time since the last frame, will be set to 0 when sim is paused; simulates CellStructure activation and Cell aging, starvation, and death - void _on_body_entered(Node *body): runs when another Node collides with this one; increments CollisionCount - void _on_cell_growth(): triggered by a CellMembrane signal; increases this Cell's size if its nutrients and energy are sufficient diff --git a/docs/src/main_menu_button.md b/docs/src/main_menu_button.md index 2e85e04..7258727 100644 --- a/docs/src/main_menu_button.md +++ b/docs/src/main_menu_button.md @@ -11,7 +11,7 @@ Description: The main menu button is a UI element that triggers the simulation r None ### Methods -- void _pressed(): Uses CellSpawner to kill all Cells and then finds and makes all current ui elements invisible while reopening the main menu and spawns background cells. It also resets statistics like time and collisions. +- void _pressed(): Uses CellSpawner to kill all Cells and NutrientZones and then finds and makes all current ui elements invisible while reopening the main menu, unpausing if paused and spawns background cells. It also resets statistics like time and collisions. ## Non-Member Functions None diff --git a/docs/src/nutrient_zone.md b/docs/src/nutrient_zone.md new file mode 100644 index 0000000..ccdc9f3 --- /dev/null +++ b/docs/src/nutrient_zone.md @@ -0,0 +1,48 @@ +# NutrientZone Description + +## Classes + +NutrientZone +Inherits: Area2D +Inherited by: none + +Description: The NutrientZone object represents a location within the simulation that stores nutrients that are able to be consumed and used by cells + +### Properties +- _totalNutrients (float): the amount of nutrients that are currently within the zone +- _nutrientMaximum (float): the maximum amount of nutrients that can be within the zone +- _feedingRate (float): the main element that can be set to dermine how much a cell can get from a zone in one run of the _process function +- _regenerationRate (float): multiplied by delta and then used to increase _totalNutrients by that amount +- _feedingCells (Vector): an array that stores all of the cells that are currently in the zone +- _deleteOnEmpty (bool): if true the NutrientZone will remove itself upon running out of nutrients, otherwise it will remain onscreen + +### Methods +- void _on_body_entered(Node *): puts cells into _feedingCells array when entering the zone + +- void _on_body_exited(Node *): takes cells out of _feedingCells array when exiting the zone + +- void applyScale(const float): applies a linear scaling to the NutrientZone; updates the Sprite2D and CollisionShape2D + +- float incrementTotalNutrients(const float): increases _totalNutrients by a number, if result is less than 0 or greater than _nutrientMaximum set to respective bound + +- void setTotalNutrients(const float): sets _totalNutrients to a number if it is greater than zero +- float getTotalNutrients() const: returns _totalNutrients + +- void setNutrientMaximum(const float): if greater or equal 0 sets _nutrientMaximum to the float +- float getNutrientMaximum() const: returns _nutrientMaximum + +- void setFeedingRate(const float): if greater than 0 sets _feedingRate to the float +- float getFeedingRate() const: returns _feedingRate + +- void setRegenerationRate(const float): if greater or equal 0 sets _regenerationRate to the float +- float getRegenerationRate() const: returns _regenerationRate + +- void setDeleteOnEmpty(const bool): sets _deleteOnEmpty to the bool +- bool getDeleteOnEmpty() const: returns _deleteOnEmpty + +- void _ready(): Connects body_entered and body_exited singals with _on_body_entered and _on_body_exited functions; gets sprite; removes itself if spawned with no nutrients + +- void _process(float): runs once per in-game frame; delta stores the real time since the last frame, will be set to 0 when sim is paused; regenerates nutrients based on _regenerationRate and increases nutrients of cells in the zone/_feedingCells based on the _feedingRate and NutrientZone scale split evenly between all cells; the total nutrients given is then removed from the NutrientZone + +## Non-Member Functions +None \ No newline at end of file diff --git a/docs/src/reset_button.md b/docs/src/reset_button.md index 0937261..abd4bef 100644 --- a/docs/src/reset_button.md +++ b/docs/src/reset_button.md @@ -11,7 +11,7 @@ Description: The reset button is a UI element that triggers the simulation to re None ### Methods -- void _pressed(): Uses CellSpawner to kill all Cells and then uses it again to spawn new ones. It also resets statistics like time and collisions. +- void _pressed(): Uses CellSpawner to kill all Cells and then uses it again to spawn new ones. It also resets statistics like time and collisions and unpauses the simulation if paused ## Non-Member Functions None diff --git a/docs/src/stats_counter.md b/docs/src/stats_counter.md index 3ec9607..1625f2d 100644 --- a/docs/src/stats_counter.md +++ b/docs/src/stats_counter.md @@ -12,7 +12,7 @@ Description: The stats counter is a label that counts the total number of collis None ### Methods -- void _process(double delta): runs once per in-game frame; updates the text of this label with the static Cell property CollisionCount +- void _process(double delta): runs once per in-game frame if not paused; updates the text of this label with the static Cell property CollisionCount ## Non-Member Functions None diff --git a/docs/src/time_counter.md b/docs/src/time_counter.md index 6bb2fe1..4dce29e 100644 --- a/docs/src/time_counter.md +++ b/docs/src/time_counter.md @@ -12,7 +12,7 @@ Description: The Time counter is a label that displays the simulation's current None ### Methods -- void _process(double delta): runs once per in-game frame; updates the text of this label with the the previous time plus delta the change in time. +- void _process(double delta): runs once per in-game frame if not paused; updates the text of this label with the the previous time plus delta the change in time. ## Non-Member Functions None