private void Update() { if (currentState == CurrentSimState.InSim) { environmentManager.gameObject.SetActive(true); fishManager.gameObject.SetActive(true); sharkManager.gameObject.SetActive(true); timeManager.gameObject.SetActive(true); fishTarget.gameObject.SetActive(true); playerController.enabled = true; inSimCanvas.SetActive(true); preSimCanvas.SetActive(false); } else if (currentState == CurrentSimState.PreSim) { inSimCanvas.SetActive(false); preSimCanvas.SetActive(true); UpdateEnvironmentValues(); UpdateFishValues(); UpdateSharkValues(); } if (currentState == CurrentSimState.InSim && (fishManager.allFish.Count <= 0 || sharkManager.allSharks.Count <= 0)) { currentState = CurrentSimState.EndSim; } }
private void Awake() { fishGraphCanvas.SetActive(false); kelpGraphCanvas.SetActive(false); currentState = CurrentSimState.PreSim; // Sets the initial state of the sim to be pre-sim. // Sets all of the required managers to inactive // on the simulation start so as to avoid them // carrying out behaviour before values are set. environmentManager.gameObject.SetActive(false); fishManager.gameObject.SetActive(false); sharkManager.gameObject.SetActive(false); timeManager.gameObject.SetActive(false); fishTarget.gameObject.SetActive(false); playerController.enabled = false; // Only set this script and not object to false as we still need the camera it is attached to }
public void StartSimulation() { currentState = CurrentSimState.InSim; }