Skip to content

Commit ad16432

Browse files
committed
Advanced version
Added a more complex version of the game with a start screen and an infinite option that will keep spawning collectibles.
1 parent 3d587ab commit ad16432

File tree

408 files changed

+18389
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+18389
-0
lines changed

CollectThemAll/.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
7+
# Standard to msysgit
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
10+
*.docx diff=astextplain
11+
*.DOCX diff=astextplain
12+
*.dot diff=astextplain
13+
*.DOT diff=astextplain
14+
*.pdf diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

CollectThemAll/.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[Ll]ibrary/
2+
[Tt]emp/
3+
[Oo]bj/
4+
[Bb]uild/
5+
6+
# Autogenerated VS/MD solution and project files
7+
*.csproj
8+
*.unityproj
9+
*.sln
10+
*.suo
11+
*.tmp
12+
*.user
13+
*.userprefs
14+
*.pidb
15+
*.booproj
16+
17+
# Unity3D generated meta files
18+
*.pidb.meta
19+
20+
# Unity3D Generated File On Crash Reports
21+
sysinfo.txt

CollectThemAll/Assets/Cardboard.meta

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CollectThemAll/Assets/Cardboard/Distortion.meta

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2015 Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
16+
// To use in a surface shader, add the following text to the code:
17+
//
18+
// #pragma surface ... vertex:vert <-- add "vertex:vert" to this line
19+
// #include "CardboardDistortion.cginc" <-- copy the next 4 lines
20+
// void vert (inout appdata_base v) {
21+
// v.vertex = undistortSurface(v.vertex);
22+
// }
23+
24+
// To use in a vertex shader, modify it as follows:
25+
//
26+
// #include "CardboardDistortion.cginc" <-- add this
27+
//
28+
// v2f vert (appdata_blah v) {
29+
// v2f o;
30+
// o.vertex = undistortVertex(v.vertex); <-- replace "mul(UNITY_MATRIX_MVP, v.vertex)"
31+
// ...
32+
// return o;
33+
// }
34+
35+
float4 _Undistortion;
36+
float _MaxRadSq;
37+
float _NearClip;
38+
float4x4 _RealProjection;
39+
float4x4 _FixProjection;
40+
41+
// Convert point from world space to undistorted camera space.
42+
float4 undistort(float4 pos) {
43+
// Go to camera space.
44+
pos = mul(UNITY_MATRIX_MV, pos);
45+
if (pos.z <= -_NearClip) { // Reminder: Forward is -Z.
46+
// Undistort the point's coordinates in XY.
47+
float r2 = clamp(dot(pos.xy, pos.xy) / (pos.z*pos.z), 0, _MaxRadSq);
48+
pos.xy *= 1 + (_Undistortion.x + _Undistortion.y*r2)*r2;
49+
}
50+
return pos;
51+
}
52+
53+
// Multiply by no-lens projection matrix after undistortion.
54+
float4 undistortVertex(float4 pos) {
55+
return mul(_RealProjection, undistort(pos));
56+
}
57+
58+
// Surface shader hides away the MVP multiplication, so we have
59+
// to multiply by _FixProjection = inverse(MVP)*_RealProjection.
60+
float4 undistortSurface(float4 pos) {
61+
return mul(_FixProjection, undistort(pos));
62+
}

CollectThemAll/Assets/Cardboard/Distortion/CardboardDistortion.cginc.meta

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CollectThemAll/Assets/Cardboard/Editor.meta

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2015 Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using UnityEngine;
16+
using UnityEditor;
17+
using System.Collections;
18+
19+
/// A custom editor for properties on the CardboardAudioListener script. This appears in the
20+
/// Inspector window of a CardboardAudioListener object.
21+
[CustomEditor(typeof(CardboardAudioListener))]
22+
public class CardboardAudioListenerEditor : Editor {
23+
private SerializedProperty globalGainDb = null;
24+
private SerializedProperty quality = null;
25+
private SerializedProperty worldScale = null;
26+
27+
private GUIContent globalGainLabel = new GUIContent("Global Gain (dB)",
28+
"Sets the global gain of the system. Can be used to adjust the overall output volume.");
29+
private GUIContent qualityLabel = new GUIContent("Quality",
30+
"Sets the quality mode in which the spatial audio will be rendered. " +
31+
"Higher quality modes allow for increased fidelity at the cost of greater CPU usage.");
32+
private GUIContent worldScaleLabel = new GUIContent("World Scale",
33+
"Sets the ratio between game units and real world units (meters).");
34+
35+
void OnEnable () {
36+
globalGainDb = serializedObject.FindProperty("globalGainDb");
37+
quality = serializedObject.FindProperty("quality");
38+
worldScale = serializedObject.FindProperty("worldScale");
39+
}
40+
41+
/// @cond
42+
public override void OnInspectorGUI () {
43+
serializedObject.Update();
44+
45+
// Rendering quality can only be modified through the Inspector in Edit mode.
46+
GUI.enabled = !EditorApplication.isPlaying;
47+
EditorGUILayout.PropertyField(quality, qualityLabel);
48+
GUI.enabled = true;
49+
50+
EditorGUILayout.Separator();
51+
52+
EditorGUILayout.Slider(globalGainDb, CardboardAudio.minGainDb, CardboardAudio.maxGainDb,
53+
globalGainLabel);
54+
EditorGUILayout.Slider(worldScale, CardboardAudio.minWorldScale, CardboardAudio.maxWorldScale,
55+
worldScaleLabel);
56+
57+
serializedObject.ApplyModifiedProperties();
58+
}
59+
/// @endcond
60+
}

CollectThemAll/Assets/Cardboard/Editor/CardboardAudioListenerEditor.cs.meta

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Copyright 2015 Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using UnityEngine;
16+
using UnityEditor;
17+
using System.Collections;
18+
19+
/// A custom editor for properties on the CardboardAudioRoom script. This appears in the Inspector
20+
/// window of a CardboardAudioRoom object.
21+
[CustomEditor(typeof(CardboardAudioRoom))]
22+
[CanEditMultipleObjects]
23+
public class CardboardAudioRoomEditor : Editor {
24+
private SerializedProperty leftWall = null;
25+
private SerializedProperty rightWall = null;
26+
private SerializedProperty floor = null;
27+
private SerializedProperty ceiling = null;
28+
private SerializedProperty backWall = null;
29+
private SerializedProperty frontWall = null;
30+
private SerializedProperty reflectivity = null;
31+
private SerializedProperty reverbGainDb = null;
32+
private SerializedProperty reverbBrightness = null;
33+
private SerializedProperty reverbTime = null;
34+
private SerializedProperty size = null;
35+
36+
private GUIContent surfaceMaterialsLabel = new GUIContent("Surface Materials",
37+
"Room surface materials to calculate the acoustic properties of the room.");
38+
private GUIContent surfaceMaterialLabel = new GUIContent("Surface Material",
39+
"Surface material used to calculate the acoustic properties of the room.");
40+
private GUIContent reflectivityLabel = new GUIContent("Reflectivity",
41+
"Adjusts what proportion of the direct sound is reflected back by each surface, after an " +
42+
"appropriate delay. Reverberation is unaffected by this setting.");
43+
private GUIContent reverbGainLabel = new GUIContent("Gain (dB)",
44+
"Applies a gain adjustment to the reverberation in the room. The default value will leave " +
45+
"reverb unaffected.");
46+
private GUIContent reverbPropertiesLabel = new GUIContent("Reverb Properties",
47+
"Parameters to adjust the reverb properties of the room.");
48+
private GUIContent reverbBrightnessLabel = new GUIContent("Brightness",
49+
"Adjusts the balance between high and low frequencies in the reverb.");
50+
private GUIContent reverbTimeLabel = new GUIContent("Time",
51+
"Adjusts the overall duration of the reverb by a positive scaling factor.");
52+
private GUIContent sizeLabel = new GUIContent("Size", "Sets the room dimensions.");
53+
54+
void OnEnable () {
55+
leftWall = serializedObject.FindProperty("leftWall");
56+
rightWall = serializedObject.FindProperty("rightWall");
57+
floor = serializedObject.FindProperty("floor");
58+
ceiling = serializedObject.FindProperty("ceiling");
59+
backWall = serializedObject.FindProperty("backWall");
60+
frontWall = serializedObject.FindProperty("frontWall");
61+
reflectivity = serializedObject.FindProperty("reflectivity");
62+
reverbGainDb = serializedObject.FindProperty("reverbGainDb");
63+
reverbBrightness = serializedObject.FindProperty("reverbBrightness");
64+
reverbTime = serializedObject.FindProperty("reverbTime");
65+
size = serializedObject.FindProperty("size");
66+
}
67+
68+
/// @cond
69+
public override void OnInspectorGUI () {
70+
serializedObject.Update();
71+
72+
EditorGUILayout.LabelField(surfaceMaterialsLabel);
73+
++EditorGUI.indentLevel;
74+
DrawSurfaceMaterial(leftWall);
75+
DrawSurfaceMaterial(rightWall);
76+
DrawSurfaceMaterial(floor);
77+
DrawSurfaceMaterial(ceiling);
78+
DrawSurfaceMaterial(backWall);
79+
DrawSurfaceMaterial(frontWall);
80+
--EditorGUI.indentLevel;
81+
82+
EditorGUILayout.Separator();
83+
84+
EditorGUILayout.Slider(reflectivity, 0.0f, CardboardAudio.maxReflectivity, reflectivityLabel);
85+
86+
EditorGUILayout.Separator();
87+
88+
EditorGUILayout.LabelField(reverbPropertiesLabel);
89+
++EditorGUI.indentLevel;
90+
EditorGUILayout.Slider(reverbGainDb, CardboardAudio.minGainDb, CardboardAudio.maxGainDb,
91+
reverbGainLabel);
92+
EditorGUILayout.Slider(reverbBrightness, CardboardAudio.minReverbBrightness,
93+
CardboardAudio.maxReverbBrightness, reverbBrightnessLabel);
94+
EditorGUILayout.Slider(reverbTime, 0.0f, CardboardAudio.maxReverbTime, reverbTimeLabel);
95+
--EditorGUI.indentLevel;
96+
97+
EditorGUILayout.Separator();
98+
99+
EditorGUILayout.PropertyField(size, sizeLabel);
100+
101+
serializedObject.ApplyModifiedProperties();
102+
}
103+
/// @endcond
104+
105+
private void DrawSurfaceMaterial (SerializedProperty surfaceMaterial) {
106+
#if UNITY_4_5
107+
surfaceMaterialLabel.text = ObjectNames.NicifyVariableName(surfaceMaterial.name);
108+
#else
109+
surfaceMaterialLabel.text = surfaceMaterial.displayName;
110+
#endif
111+
EditorGUILayout.PropertyField(surfaceMaterial, surfaceMaterialLabel);
112+
}
113+
}

CollectThemAll/Assets/Cardboard/Editor/CardboardAudioRoomEditor.cs.meta

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)