-
Notifications
You must be signed in to change notification settings - Fork 1
Fish Factory Scripts
All of the project scripts are monobehaviour, including our GameManager. Here are some important information about some of the scripts. For more details about these scripts and other scripts in the project, see comments in code.
The GameManager keeps track of the player's progress and the state of the simulation throughout the Fish Factory. Some important things to note:
- The GameManager is a Singleton, meaning that only one instance of the GameManager can exist at any given time.
- The GameManager should be present in every scene, and should not be destroyed when loading a new scene to ensure persistence of the player's progress.
- The GameManager is connected to the AudioManager object in every scene to play sound effects. The AudioManager prefab should therefore be present in every scene.
- The GameManager will dynamically find the AudioManager object in the scene, as well as the game objects for the player's hands, to ensure that the player's gloves are set correctly.
The FactoryFishSpawner is used to spawn the fish prefab in varying sizes and with varying textures. Some important things to note:
- "Toggle fish variation" should be toggled in the Bleeding Station. This will spawn fish with variation in size and state.
- Percentages for different fish states "alive", "bad" and "stunned" are kept as percentages from 0 to 100. The script first checks alive chances, then unedible (bad fish) chances, and the remaining percent is stunned. Eg. if alive percent is set to 100 - then all fish will be spawned as alive.
- "Toggle fish tier" should be toggled on in the QA station, but only for the spawners spawning fish for the sorting machine. The "tier 1", "tier 2" and "tier 3" percentages works the same way as the "alive", "bad" and "stunned" percentages.
- "Toggle fish gutting chance" should only be toggled for the spawners spawning fish for the gutting station. The "successful gutting", "incomplete gutting" and "bad gutting" percentages works the same way as the "alive", "bad" and "stunned" percentages.
- Big variations in size does not work well with the FishFactorySalmon prefab, as the armature objects do not resize properly.
The FactoryFishState is used to make and assign states to the fish as well as containing methods to change the states when needed and a function to move fish that are alive. Some important things to note:
- The script is attached to the
FishFactorySalmonand theFishFactoryBadFishas a component. - The function
CutFishGillsis used in the bleeding station to check if the user has cut the fish gills on a fish with the correct state and will give feedback and change the state accordingly.
The FishSortingButton script is used on the buttons on the sorting machine prefab in order to change the active tier the fish gets put into. Some important things to note:
-
"_currentTier"is used for ensuring only one active fish tier at a time. - The list
"_sortedFish"is used by the scriptFishSortingTrigger.csto allow a fish to be sorted only once. - The
SetTiermethod is used to set the_currentTier
The FishSortingTrigger script is used with the sorting machine prefab to check if the fish has been sorted correctly, and to open the correct door to let the fish slide down onto the conveyor. Some important things to note:
- The
_doorvariable is a serialize field that maps a trigger to the door it opens. - The
_tierManagervariable is a serialize field that maps the QA machine's currently set tier state.
This script holds boilerplate code for linking gill and body related scripts to knife and fish state. This keeps our code DRY. It also has a method called cutEventwhich can handle both gill- and body cuts.
The script CutFishBody call the method "cutEvent" if the knife collides with the trigger box the script is a component of. This will be registered as a wrong cut. It inherits the method from CutFish
The script CutFishGill call the method "cutEvent" if the knife collides with the trigger box the script is a component of. This will be registered as a correct cut. CutFish
The script StunFish is used on the StunMachine prefab to stun fish that are alive.
The DiscardBadFish script is used to allow the player to discard fish that has gone bad or are dead. Some important things to note:
- The
DiscardBadFishscript is placed as a component on an invisible trigger box inside the discard tub model. - The variable
"_destroyFishTreshold"allows the discard box to accumulate a set number of fish instead of deleting them instantly. This threshold can be adjusted in the editor.
The KnifeState script determines if the knife should chip and changes the blade model to a chipped blade. Some important things to note:
- The
"_durabilityCount"is set to 5 as default but can be changed in the editor or can be assigned a random value.
Authors:
Trym Lund Flogard
Emil Aron Andresen Mathiesen
Tor Jacob Neple
Quynh-Lan Nguyen Pham
Markus Aleksander Råkil Johansen
Jon Pape Hallem
Herman Sætre
Mikkel Emil Lange Friis
Peter Olai Johnsen
The reception scene is the first scene the player will find themselves in after the application has started. It serves as a central hub between the different work place scenarios.
The fish laboratory is a subsystem of blue-sector, which runs a simulation of tasks related to analysing the health of the salmon population in a fish farm.
The fish factory is a subsystem of blue-sector, which runs a simulation of several tasks at a farmed Atlantic salmon processing facility.
Fish feeding is a subsystem of blue-sector, which runs a simulation of feeding salmon in a fish farming facility.
This section is related to the improvements to the NPC AI functionality and the connecting system that it now works with.