Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattHolliday committed Apr 23, 2024
1 parent ccf3ad2 commit 00a80bd
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main_menu_button.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
48 changes: 48 additions & 0 deletions docs/src/nutrient_zone.md
Original file line number Diff line number Diff line change
@@ -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<Cell *>): 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
2 changes: 1 addition & 1 deletion docs/src/reset_button.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/src/stats_counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/src/time_counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 00a80bd

Please sign in to comment.