Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gstuitje
RingMaster
Commits
1168c5df
Commit
1168c5df
authored
Jan 21, 2019
by
gstuitje
Browse files
Can now skip to starting at different points in a song
parent
403ba606
Changes
6
Hide whitespace changes
Inline
Side-by-side
RingMaster/RingMaster/.vs/RingMaster/xs/UserPrefs.xml
View file @
1168c5df
<Properties
StartupConfiguration=
"{67A4F128-F6AC-CD88-DA35-F29416A0792A}|"
>
<MonoDevelop.Ide.ItemProperties.Assembly-CSharp
PreferredExecutionTarget=
"Unity.Editor"
/>
<MonoDevelop.Ide.Workbench
ActiveDocument=
"Assets/Scripts/
Spawn
Key
s
.cs"
>
<MonoDevelop.Ide.Workbench
ActiveDocument=
"Assets/Scripts/Key.cs"
>
<Files>
<File
FileName=
"Assets/TextFiles/TestMultiples.txt"
Line=
"1"
Column=
"1"
/>
<File
FileName=
"Assets/Scripts/SpawnKeys.cs"
Line=
"9"
Column=
"18"
/>
<File
FileName=
"Assets/Scripts/SpawnKeys.cs"
Line=
"60"
Column=
"59"
/>
<File
FileName=
"Assets/Scripts/Key.cs"
Line=
"1"
Column=
"1"
/>
<File
FileName=
"Assets/Scripts/TriggerManager.cs"
Line=
"1"
Column=
"1"
/>
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace
ActiveConfiguration=
"Debug"
/>
...
...
RingMaster/RingMaster/.vs/RingMaster/xs/sqlite3/storage.ide
View file @
1168c5df
No preview for this file type
RingMaster/RingMaster/.vs/RingMaster/xs/sqlite3/storage.ide-wal
View file @
1168c5df
No preview for this file type
RingMaster/RingMaster/Assets/Prefabs/Key.prefab
View file @
1168c5df
...
...
@@ -36,7 +36,7 @@ Transform:
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1765769401102260
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
5
,
y
:
4
,
z
:
0
}
m_LocalPosition
:
{
x
:
5
,
y
:
-3.99
4
,
z
:
0
}
m_LocalScale
:
{
x
:
1.6
,
y
:
1.6
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
...
...
@@ -78,7 +78,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
3ca1ceb8b7b7e47b0afcf424c76fb6a2
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
speed
:
1
speed
:
2
points
:
10
---
!u!212
&212894587835513782
SpriteRenderer
:
...
...
RingMaster/RingMaster/Assets/Scripts/SpawnKeys.cs
View file @
1168c5df
...
...
@@ -6,7 +6,10 @@ public class SpawnKeys : MonoBehaviour {
public
TextAsset
songFile
;
public
GameObject
arrowPrefab
;
public
float
skip
;
private
string
song
=
"default"
;
private
float
startTime
;
Queue
<
string
[
]>
songKeys
=
new
Queue
<
string
[
]>
();
string
[]
nextKey
;
...
...
@@ -15,7 +18,7 @@ public class SpawnKeys : MonoBehaviour {
float
[]
timings
;
int
pointer
=
0
;
float
s
tar
tTime
;
float
s
ongWai
tTime
;
// Use this for initialization
void
Start
()
{
...
...
@@ -41,7 +44,8 @@ public class SpawnKeys : MonoBehaviour {
{
songKeys
.
Enqueue
(
line
.
Split
(
' '
));
}
else
{
song
=
line
;
song
=
line
.
Split
(
' '
)[
0
];
songWaitTime
=
float
.
Parse
(
line
.
Split
(
' '
)[
1
]);
}
count
++;
}
...
...
@@ -52,37 +56,50 @@ public class SpawnKeys : MonoBehaviour {
// string[] x = songKeys.Dequeue();
// print(x[0] + " " + x[1]);
//}
print
(
song
);
print
(
Resources
.
Load
(
"Bavaria"
));
AudioClip
songAudio
=
Resources
.
Load
<
AudioClip
>(
song
);
AudioSource
.
PlayClipAtPoint
(
songAudio
,
transform
.
position
);
songWaitTime
=
songWaitTime
/
arrowPrefab
.
GetComponent
<
Key
>().
speed
;
StartCoroutine
(
playSong
(
songAudio
,
songWaitTime
));
}
//plays the song after the first arrow reaches a barrier.
private
IEnumerator
playSong
(
AudioClip
musicClip
,
float
waitTime
){
yield
return
new
WaitForSeconds
(
waitTime
);
AudioSource
music
=
transform
.
GetComponent
<
AudioSource
>();
music
.
clip
=
musicClip
;
music
.
Play
();
music
.
time
=
skip
;
}
// Update is called once per frame
void
Update
()
{
while
(
nextKey
!=
null
&&
Time
.
time
>
startTime
+
float
.
Parse
(
nextKey
[
1
]))
while
(
nextKey
!=
null
&&
Time
.
time
>
startTime
+
float
.
Parse
(
nextKey
[
1
])
-
skip
)
{
switch
(
nextKey
[
0
])
{
case
"left"
:
//print("left");
Instantiate
(
arrowPrefab
,
new
Vector3
(
5f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
case
"right"
:
//print("right");
Instantiate
(
arrowPrefab
,
new
Vector3
(
8f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
case
"up"
:
//print("up");
Instantiate
(
arrowPrefab
,
new
Vector3
(
6f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
case
"down"
:
//print("DOWN");
Instantiate
(
arrowPrefab
,
new
Vector3
(
7f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
default
:
break
;
if
(
float
.
Parse
(
nextKey
[
1
])
>=
skip
)
{
switch
(
nextKey
[
0
])
{
case
"left"
:
//print("left");
Instantiate
(
arrowPrefab
,
new
Vector3
(
5f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
case
"right"
:
//print("right");
Instantiate
(
arrowPrefab
,
new
Vector3
(
8f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
case
"up"
:
//print("up");
Instantiate
(
arrowPrefab
,
new
Vector3
(
6f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
case
"down"
:
//print("DOWN");
Instantiate
(
arrowPrefab
,
new
Vector3
(
7f
,
4f
,
1f
),
Quaternion
.
identity
);
break
;
default
:
break
;
}
}
if
(
songKeys
.
Count
>
0
)
{
...
...
RingMaster/RingMaster/Assets/TextFiles/Bavaria.txt
View file @
1168c5df
Bavaria
left 1
right 1.5
up 2.34
down 4.3
right 5.5
left 5.5
\ No newline at end of file
Bavaria 7.8
left 0
right 0.3
up 0.6
down 1.1
up 1.6
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment