using System.Collections; using System.Collections.Generic; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame { public class Stay : NoteBase { public static Stay GenerateElement(string elementName, float exactJudgeTime, BaseElement attach) { Stay stay = LeanPool.Spawn(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent(); stay.NewInitialize(elementName, exactJudgeTime); stay.SetParent(attach); if (attach.TryGetComponent(out Track track)) { if (track.trackTimeSubmodule != null) { stay.track = track; stay.trackPositioner.spline = track.trackPathSubmodule.path; stay.isOnTrack = true; stay.UpdateNoteInTrack(); } else { throw new System.Exception("如果Note要生成在Track上,Track必须有TrackTimeSubmodule组件。"); } } else { } return stay; } public void NewInitialize(string elementName, float exactJudgeTime) { base.NewInitialize(elementName); this.exactJudgeTime = exactJudgeTime; this.track = null; this.isOnTrack = false; } } }