Game Script Compendium - GeneRainier/salmon-run-working GitHub Wiki

The following page is a list of all of the scripts within the game and what their general purposes are. Functions that are more complex and require a more complex description are also compiled so that it is easier to look through the Salmon Run Code at a glance or to figure out where certain processes are handled. This page is organized by Folder -> Individual Script -> Description and additional functions.


DebugReload - A simple script that allows the current Unity scene to be reloaded by pressing a single button.

DrawArrow - A script that draws arrows for the Vector Field Pathfinding used in a previous version of Salmon Run.

Filters (as in scripts that filter which fish get through)

FilterBase - A script containing the class information for a filter type object. These are objects that fish pass through as they swim that may keep them from progressing, such as a dam.

Dam - Script for the functions of a dam. This includes drag-and-drop placement of the dam, Base class (FilterBase) implementation of abstract functions, and addition of a ladder to the dam.

DamLadder - Script for the functions of a dam ladder. There are a few types of dam ladder within the game, but each has a different set of pass rates for each size of fish. All of these pass rates are generally better than the base rates of a dam on its own. Unlike Dam, this is not derived from the FilterBase class, so it does not implement those abstract functions.


Fish - Monobehavior Class that controls a single fish. Every fish that spawns in the game has this script attached and it includes various items such as the total energy of the fish, movement and rotation speed, and references to other fish classes like a FishGenome.

FishGenome - Script that defines a basic genome for a fish to possess. This genome handles both the fish's biological sex and the fish's size.

FishGenomeUtilities - Script with a series of utility functions mainly aimed at creating a new generation of fish at the end of each round. Also has functions for getting every fish of a particular type (small, medium, and large) and returning them as a list.

FishPrefabConfig - A script that determines which fish should be spawned in based on the results of the FishGenomeUtilities functions. Given a list of fish to spawn in, this script will determine which Unity project prefab matches each fish's genome so each fish has the correct appearance.

FishSchool - Script that manages commands and calculations for the entire, current fish population. This includes spawning in fish using the FishGenomeUtilities functions and the FishPrefabConfig script, commanding every fish to move, and updating / removing fish in the event they have been caught or have died.

Population - Script that keeps a list of the latest population of fish each round by emptying the list from the prior round that remain and filling the list with what fish have been spawned by the FishGenomeUtilities script functions.

RandomizeColor_Interval - Script that randomly assigns various colors and appearance features to fish.


GameState - A base class that defines, via abstract functions, actions the game must take when entering, maintaining, or exiting a particular state. This is essentially an outline for what a state looks like.

PlaceState - The initial state of the game and the state between rounds. This is the period when players can set up towers. This state simply pauses the game.

RunState - The state that is triggered by hitting the play button. This begins the next generation of salmon swimming upstream. It also sets the game to the normal speed based on what the GameManager script says that speed should be. When a round ends, this script increments the turn count and formally ends the generation's run.

RunStatsState - Invokes the appearance of the stats screen at the end of a round via GameEvents.

EndState - The state that is entered when the game ends. This is distinct from quitting the application. This would mean a win or lose condition has been reached such as the salmon population hitting 0.


GameManager - Script that controls the overall flow of the game including game speed, key button clicks, and transitions between states.

ManagerIndex - Script that includes a reference to all the managers in the game and the initialization values for towers, output files, and UI.

GameEvents - Script that contains definitions for the various UnityEvents that handle key transitions in the game.

TowerManager - Script that contains class definitions for an individual tower and the Manager itself. The Manager maintains a list of towers and can grab a towers individual cost, the tower itself, or update the color of every tower of a particular type. There is also a public enum of the various types of tower for reference by the Manager class. The Tower class includes the cost, UI, and type of the tower as well as some simple functions for enabling, disabling, and checking the cost of the tower on purchase.

Upgrade Manager - Script that handles all of the upgrades in the game. After an upgrade is purchased, this script makes all of the adjustments to the particular tower being upgraded in terms of tower settings and visuals. Also contains a class definition for an Upgrade type object.

MoneyManager - Script that handles all initializations, increases, and decreases to the player's money total as towers and upgrades are purchased.

TimeManager - Script that handles the speed of the game as requested by Events and the GameManager. This script defines the various speeds via an enum and has a number of simple, callable functions for setting the speed based on the UI buttons the player clicks.

EvolutionManager - Outdated script from earlier in the game's development that worked with the Color Manager to create different looking fish based on their genes. Will likely be revised after the main game loop is developed in April of 2022.

ColorManager - A script to work with EvolutionManager in making a multitude of different looking fish. Currently, does nothing.

PlacementVisualizationManager - For objects, such as dams, this script shows a transparent visual in the scene via the DamPlacementLocation script to show where a player may place a dam in the level.


IPauseable - Interface for objects that can be paused and resumed by the game. This is used rather than a simple use of Time.timeScale because some objects (e.g. the camera motion) should never be paused, while others (like fish & towers) should be.

SpawningGrounds - Script placed on the final destination of the salmon. This represents the place the salmon are trying to reach to spawn. This script handles much of the counting associated with the stats screen by tracking the genomes of the fish that come in contact with it.


ColorPreset - Scriptable Object that can be applied to each tower to define what colors the tower should have for each body part (hair, skin, clothes, etc.).


IDragAndDropObjects - Interface for all towers in the game that the TowerBase class inherits from. Provides shared variables and functions regarding placing towers into the scene from the UI menu.

DamPlacementLocation - Script that handles the placement of a dam when it is being dragged and dropped into the scene.

SealionSpawner - Script handles the spawning of a sealion into the game scene after the dam has been placed by a player.

Static Scripts

GameObjectFunctions - Series of generic functions that can be used by a variety of game objects for convenience such as smooth movement and rotation as well as acquiring the center of a game object.

InputFunctions - Series of helpful functions regarding input, mainly mouse movement, to track user movement and quickly convert screen space to Unity space.

UtilityFunctions - A script of helpful utility functions. Mostly consists of math calculations such as Lerps and clamps that are difficult to write repeatedly. Also includes more complicated string hashing and GUID generation.


TowerBase - Base class used by all towers. Implements Drag and Drop interface, Pauseable Interface, and basic application of the towers effect over a given range.

TowerRangeEffect - Script that handles all the details of a tower's range including how large that range is and whether something is within that range or not. Mainly, this is to handle visuals of where the tower will affect other game objects when it is being place in the scene.

AnglerTower - Script that defines an angler. This includes, their range, catch rates, cost, and any abstract implementations from TowerBase.

RangerTower - Script that defines a ranger. This includes, their range, modification rates to anglers, cost, and any abstract implementations from TowerBase.

SealionTower - Script that defines a sealion. This includes, their range, catch rates, turns until arrival after a dam is placed, and any abstract implementations from TowerBase.

UI (User Interface)


UpgradeUI - Script that tracks whether or not UI elements relevant to upgrades and tower switching (such as switching out different dam ladders) should be selectable / enable or not.

PanelSwitching - Script that simply ensures that the correct panel is in front by way of setting the panel to be on top of other panels.


SetActiveUtils - Script to allow game objects and all their respective children to be set to active.

Layers - Script that contains string names for various layers game objects are placed on in the game scene. There is also a function to move a game object and its respective children to a particular layer.

EndGame - In progress script that is aimed at handling the ending of a game whether via win or lose.

Miscellaneous Scripts (Scripts not currently stored in any sub folder)

FishPath -