1.在第一次与父亲对话时加入了对电报机操作的语言 2.在序章中的背景加入视差 3.加入了一个Shake脚本,以提供物体震动(实装到了石堆上面 效果还可以) 4.对检查死亡的机枪手的对话(我不会用fungus哼哼啊啊啊啊) 1)(已经是一具没有气息的尸体了) 2)父亲被你们所害,这是你们罪有应得。
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class BGMPlayer : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
private AudioSource audioPlayer;
|
|
private bool isSlowlyStopTheClip;
|
|
[Tooltip("请填入BGM切换时淡出原BGM的速度")]
|
|
public float fadeSpeed;
|
|
private AudioClip newBGM;
|
|
private float defulatVolume;
|
|
|
|
|
|
void Start()
|
|
{
|
|
DontDestroyOnLoad(gameObject);
|
|
audioPlayer = GetComponent<AudioSource>();
|
|
defulatVolume = audioPlayer.volume;
|
|
if(FindObjectsOfType<BGMPlayer>().Length > 1) Destroy(gameObject);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if(isSlowlyStopTheClip)
|
|
{
|
|
audioPlayer.volume -= fadeSpeed*Time.deltaTime;
|
|
if(audioPlayer.volume.Equals(0f))
|
|
{
|
|
isSlowlyStopTheClip = false;
|
|
audioPlayer.clip = newBGM;
|
|
audioPlayer.volume = defulatVolume;
|
|
audioPlayer.Play();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ChangedTheBGM(AudioClip newBGM)
|
|
{
|
|
isSlowlyStopTheClip = true;
|
|
this.newBGM = newBGM;
|
|
}
|
|
}
|