65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using Ichni.RhythmGame.Beatmap;
|
||
using UnityEngine;
|
||
|
||
namespace Ichni.RhythmGame
|
||
{
|
||
public class SongInformation : IBaseElement
|
||
{
|
||
public AudioClip song; //曲目
|
||
public string songName;
|
||
public string songLocation; //曲名
|
||
public float bpm; //每分钟节拍数
|
||
public float delay; //设定音乐和谱面延迟Delay秒后开始,在延迟中,SongPosition为负数。
|
||
|
||
public float songLength;
|
||
public float offset = 0f;
|
||
public BaseElement_BM matchedBM { get; set; }
|
||
|
||
public SongInformation(string songName, float bpm, float delay, float offset)
|
||
{
|
||
this.songName = songName;
|
||
this.bpm = bpm;
|
||
this.delay = delay;
|
||
this.offset = offset;
|
||
|
||
GameManager.instance.audioManager.songPlayer.songTimeSegment = -delay; // 初始化时,歌曲时间为负
|
||
GameManager.instance.audioManager.isDelaying = delay > 0;
|
||
}
|
||
|
||
public void SaveBM()
|
||
{
|
||
matchedBM = new SongInformation_BM(songName, bpm, delay, offset);
|
||
}
|
||
}
|
||
|
||
namespace Beatmap
|
||
{
|
||
public class SongInformation_BM : BaseElement_BM
|
||
{
|
||
public string songName;
|
||
public float bpm;
|
||
public float delay;
|
||
public float offset = 0f;
|
||
|
||
public SongInformation_BM()
|
||
{
|
||
|
||
}
|
||
|
||
public SongInformation_BM(string songName, float bpm, float delay, float offset)
|
||
{
|
||
this.songName = songName;
|
||
this.bpm = bpm;
|
||
this.delay = delay;
|
||
this.offset = offset;
|
||
}
|
||
|
||
public override void ExecuteBM()
|
||
{
|
||
GameManager.instance.songInformation = new SongInformation(songName, bpm, delay, offset);
|
||
}
|
||
}
|
||
}
|
||
} |