Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Tommé Nöll
seedling
Commits
d0599b57
Commit
d0599b57
authored
Oct 06, 2019
by
Tommé Nöll
Browse files
added boss music transitions, not tested yet
parent
d08aaab3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Assets/Scripts/Audio/BackgroundMusic.cs
View file @
d0599b57
...
...
@@ -35,7 +35,7 @@ public class BackgroundMusic : MonoBehaviour {
if
(
AS
[
current
].
timeSamples
!=
preTransitionSample
)
{
inTransition
=
false
;
AS
[
other
].
volume
=
1
;
AS
[
1
-
current
].
volume
=
1
;
fadePerSecond
=
-
1
;
Debug
.
Log
(
"Music transition complete, playing "
+
AS
[
current
].
clip
.
name
+
"\nSample new: "
+
AS
[
current
].
timeSamples
+
", Sample old: "
+
AS
[
1
-
current
].
timeSamples
+
...
...
Assets/Scripts/Audio/MusicObject.cs
View file @
d0599b57
...
...
@@ -20,4 +20,11 @@ public class MusicObject : ScriptableObject {
public
bool
isLoop
=
false
;
[
Tooltip
(
"The non-looped version if this song is looped (required), the looped version otherwise (optional)."
)]
public
MusicObject
loopCounterpiece
;
public
MusicObject
()
{}
public
MusicObject
(
AudioClip
clip
)
{
this
.
clip
=
clip
;
isLoop
=
false
;
}
}
Assets/Scripts/Enemies/BossAI.cs
View file @
d0599b57
...
...
@@ -54,6 +54,8 @@ public class BossAI : MonoBehaviour
//CameraShake der MainCamera
public
CameraShake
cameraShake
;
private
BackgroundMusic
bgMusic
;
//Events, die während des Phasenwechsels screen shake den Bildschirm schwarz und wieder sichtbar machen
public
UnityEvent
screenShake
;
public
UnityEvent
fadeToBlack
;
...
...
@@ -71,7 +73,8 @@ public class BossAI : MonoBehaviour
[
SerializeField
]
private
AudioSource
audioSource
;
[
SerializeField
]
private
SoundVolume
soundVolumeHit
;
[
SerializeField
]
private
SoundVolume
soundVolumeScream1
;
[
SerializeField
]
private
SoundVolume
soundVolumeScream2
;
[
SerializeField
]
private
SoundVolume
soundVolumeScream2
;
[
SerializeField
]
private
AudioClip
[]
music
;
private
void
Awake
()
{
...
...
@@ -79,6 +82,7 @@ public class BossAI : MonoBehaviour
health
=
bossHealth
.
healthPoints
;
player
=
GameObject
.
FindGameObjectWithTag
(
"Player"
);
bgMusic
=
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
BackgroundMusic
>();
shootingPoint
=
transform
.
position
+
horizontalOffset
*
Vector3
.
right
+
verticalOffset
*
Vector3
.
up
;
...
...
@@ -160,10 +164,12 @@ public class BossAI : MonoBehaviour
if
(
health
==
3
)
{
audioSource
.
PlayOneShot
(
soundVolumeScream1
.
clip
,
soundVolumeScream1
.
volume
);
bgMusic
.
TransitionTo
(
new
MusicObject
(
music
[
1
]),
2f
);
}
else
if
(
health
==
2
)
{
audioSource
.
PlayOneShot
(
soundVolumeScream2
.
clip
,
soundVolumeScream2
.
volume
);
bgMusic
.
TransitionTo
(
new
MusicObject
(
music
[
2
]),
2f
);
}
yield
return
new
WaitForSeconds
(
timeBetweenShakeAndFade
);
...
...
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