Skip to content

Commit 5381acc

Browse files
author
Tylemagne
committed
1.0 Completion
1 parent 55df886 commit 5381acc

22 files changed

+4385
-1979
lines changed

TFM/Assets/1.unity

Lines changed: 3748 additions & 1970 deletions
Large diffs are not rendered by default.

TFM/Assets/2.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Material:
3838
m_Scale: {x: 4, y: 4}
3939
m_Offset: {x: 0, y: 0}
4040
- _MainTex:
41-
m_Texture: {fileID: 0}
41+
m_Texture: {fileID: 10305, guid: 0000000000000000f000000000000000, type: 0}
4242
m_Scale: {x: 4, y: 4}
4343
m_Offset: {x: 0, y: 0}
4444
- _MetallicGlossMap:

TFM/Assets/3.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Material:
3838
m_Scale: {x: 4, y: 4}
3939
m_Offset: {x: 0, y: 0}
4040
- _MainTex:
41-
m_Texture: {fileID: 0}
41+
m_Texture: {fileID: 10305, guid: 0000000000000000f000000000000000, type: 0}
4242
m_Scale: {x: 4, y: 4}
4343
m_Offset: {x: 0, y: 0}
4444
- _MetallicGlossMap:

TFM/Assets/Scripts/benchmaster.cs

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
6+
public class benchmaster : MonoBehaviour {
7+
8+
public Slider[] sliders;
9+
public Texture none;
10+
public Canvas dash;
11+
public AudioSource music;
12+
public Canvas cancel;
13+
public int score;
14+
public bool isBenchmarking;
15+
public float duration;
16+
public float benchStartedTime;
17+
public Canvas scoreCanvas;
18+
public Text scoreCanvasText;
19+
20+
21+
public void setAllSliders(bool state) //lock or unlock
22+
{
23+
for(int x = 0; x < sliders.Length; x++)
24+
{
25+
sliders[x].interactable = state;
26+
}
27+
28+
sliders [6].value = 0.05f;
29+
sliders [6].interactable = true;
30+
31+
32+
33+
cancel.enabled = true; //show cancel button
34+
}
35+
36+
37+
public void startBenchmarkAny()
38+
{
39+
music.Stop ();
40+
music.Play ();
41+
42+
isBenchmarking = true;
43+
setAllSliders (false);
44+
dash.enabled = false;
45+
score = 0;
46+
benchStartedTime = Time.unscaledTime;
47+
}
48+
49+
public void calibrateSliders(float cam, int globalfps, float grav, int physfps, int spawn, float times)
50+
{
51+
sliders [0].value = cam;
52+
sliders [1].value = globalfps;
53+
sliders [2].value = grav;
54+
sliders [3].value = physfps;
55+
sliders [4].value = spawn;
56+
sliders [5].value = times;
57+
58+
}
59+
60+
public void calibrateSlidersSet(int set)
61+
{
62+
if(set == 1) calibrateSliders (0.5f, 145, 1.21f, 60, 1, 0.5f); //light
63+
if(set == 2) calibrateSliders (1f, 145, 9.81f, 75, 4, 1f); //moderate
64+
if(set == 3) calibrateSliders (5f, 145, 25f, 144, 50, 2f); //extreme
65+
if(set == 4) calibrateSliders (0.1f, 145, 1.21f, 144, 8, 1f); //relaxed
66+
if(set == 5) calibrateSliders (1f, 145, 9.81f, 144, 5, 0.1f); //slomo
67+
if(set == 6) calibrateSliders (0f, 145, 9.81f, 7, 6, 0.5f); //dualfps
68+
69+
if (dash.enabled)
70+
{
71+
dash.enabled = false;
72+
}
73+
74+
GameObject[] spheres = GameObject.FindGameObjectsWithTag ("TFMSphere");
75+
76+
foreach(GameObject sphere in spheres)
77+
{
78+
DestroyImmediate (sphere);
79+
}
80+
81+
spheres = null;
82+
}
83+
84+
public void startBenchmark1()
85+
{
86+
calibrateSlidersSet (1);
87+
startBenchmarkAny ();
88+
89+
}
90+
91+
public void startBenchmark2()
92+
{
93+
calibrateSlidersSet (2);
94+
startBenchmarkAny ();
95+
}
96+
97+
public void startBenchmark3()
98+
{
99+
calibrateSlidersSet (3);
100+
startBenchmarkAny ();
101+
}
102+
103+
public void cancelBenchmark()
104+
{
105+
stopBenchmark ();
106+
scoreCanvas.enabled = false;
107+
}
108+
109+
public void stopBenchmark()
110+
{
111+
isBenchmarking = false;
112+
int avg = score / (int)duration;
113+
Debug.Log ("final score: "+score.ToString()+" avg: "+avg.ToString());
114+
scoreCanvasText.text = score.ToString();
115+
score = 0;
116+
setAllSliders (true);
117+
cancel.enabled = false;
118+
scoreCanvas.enabled = true;
119+
dash.enabled = false;
120+
}
121+
122+
public void closeScoreWindow()
123+
{
124+
scoreCanvas.enabled = false;
125+
}
126+
127+
// Use this for initialization
128+
void Start () {
129+
130+
//duration = 60f;
131+
132+
}
133+
134+
// Update is called once per frame
135+
void Update () {
136+
137+
if (isBenchmarking)
138+
{
139+
score++;
140+
}
141+
142+
if (isBenchmarking && Time.unscaledTime - benchStartedTime >= duration)
143+
{
144+
145+
stopBenchmark ();
146+
}
147+
148+
149+
150+
}
151+
}

TFM/Assets/Scripts/benchmaster.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TFM/Assets/Scripts/dtoggle.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
6+
public class dtoggle : MonoBehaviour {
7+
8+
public Canvas canvas;
9+
public int score;
10+
11+
// Use this for initialization
12+
void Start () {
13+
14+
canvas = gameObject.GetComponent<Canvas> ();
15+
16+
}
17+
18+
// Update is called once per frame
19+
void Update () {
20+
score++;
21+
22+
if (Input.GetKeyUp(KeyCode.D))
23+
{
24+
canvas.enabled = !canvas.enabled;
25+
}
26+
27+
}
28+
}

TFM/Assets/Scripts/dtoggle.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TFM/Assets/hwinfo.cs renamed to TFM/Assets/Scripts/hwinfo.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@
55

66
public class hwinfo : MonoBehaviour {
77

8-
public Text gpu2;
8+
public Text cpu;
9+
public Text gpu;
10+
public Text ram;
11+
public Text api;
912

1013
// Use this for initialization
1114
void Start () {
1215

16+
cpu.text = SystemInfo.processorType;
17+
gpu.text = SystemInfo.graphicsDeviceName;
18+
ram.text = SystemInfo.systemMemorySize.ToString()+"MB";
19+
api.text = SystemInfo.graphicsDeviceType.ToString();
20+
21+
1322
//Debug.Log (SystemInfo.graphicsDeviceType);
1423
Debug.Log ("NAME "+SystemInfo.graphicsDeviceName);
15-
gpu2.text = SystemInfo.graphicsDeviceName;
24+
1625
Debug.Log ("DID "+ SystemInfo.graphicsDeviceID);
1726
Debug.Log (SystemInfo.graphicsDeviceType);
1827
Debug.Log (SystemInfo.graphicsDeviceVendor);
File renamed without changes.

TFM/Assets/Scripts/quitter.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class quitter : MonoBehaviour {
6+
7+
// Use this for initialization
8+
void Start () {
9+
10+
}
11+
12+
// Update is called once per frame
13+
void Update () {
14+
15+
if (Input.GetKeyUp (KeyCode.Q))
16+
{
17+
Debug.Log ("QUIT!");
18+
Application.Quit ();
19+
}
20+
21+
}
22+
}

0 commit comments

Comments
 (0)