Skip to content

Commit

Permalink
Time Speed Up
Browse files Browse the repository at this point in the history
Time can now be sped up, but it is not yet doable for a user. It only works in the editor.
  • Loading branch information
Quantam-Studios committed Mar 14, 2022
1 parent b56886d commit 3ff14ea
Show file tree
Hide file tree
Showing 6 changed files with 583 additions and 1,447 deletions.
3 changes: 2 additions & 1 deletion ScienceFair21-22/Assets/Scenes/Simulation.unity
Original file line number Diff line number Diff line change
Expand Up @@ -8133,7 +8133,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &774675905
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -21376,6 +21376,7 @@ MonoBehaviour:
paused: 0
simStarted: 0
timer: {fileID: 727430563}
setTimeScale: 4
creatures:
- {fileID: 701712849}
- {fileID: 2073606335}
Expand Down
10 changes: 8 additions & 2 deletions ScienceFair21-22/Assets/Scripts/MenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class MenuManager : MonoBehaviour

// TIME LIMIT
public Timer timer;
// time
public float setTimeScale;
public static float timeScale;

// CREATURE TYPE
// For interactivity between other scripts
Expand Down Expand Up @@ -93,6 +96,9 @@ void Start()
{
activeCreatures[i] = false;
}

// set timeScale
timeScale = setTimeScale;
}

private void Update()
Expand Down Expand Up @@ -138,7 +144,7 @@ public void ResumeSimulation()
// set false to allow pausing to happen again
paused = false;
// start time
Time.timeScale = 1;
Time.timeScale = timeScale;
}

// THE FOLLOWING FUNCTIONS ARE CALLED WHEN THE BUTTON "Run Simulation Button" IS PRESSED
Expand All @@ -153,7 +159,7 @@ public void RunSimulation()
foodManager.SetActive(true);
// begin simulating
simStarted = true;
Time.timeScale = 1;
Time.timeScale = timeScale;
// begin logging
creatureStatistics.initializeNewLog();
predatorStatistics.SetRecordingInterval();
Expand Down
3 changes: 3 additions & 0 deletions ScienceFair21-22/Assets/Scripts/QueueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public class QueueManager : MonoBehaviour
public int activeTrialIndex;
public bool started;

// THESE ARE FOR OTHER SCRIPTS TO KNOW WHAT TO DO


// Start is called before the first frame update
void Start()
{
Expand Down
2 changes: 2 additions & 0 deletions ScienceFair21-22/Assets/Scripts/QueueSetupMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class QueueSetupMenu : MonoBehaviour
// QUEUE MANAGER
public QueueManager queueManager;

//


private void Update()
{
Expand Down
Loading

0 comments on commit 3ff14ea

Please sign in to comment.