Files
ichni_Creator_Studio/Assets/Scripts/GameElements/Notes/Tap.cs
SoulliesOfficial 552651efbc 基础内容-4
Tap,Stay,Flick基础构造
2025-01-28 11:58:39 -05:00

46 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections;
using System.Collections.Generic;
using Lean.Pool;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class Tap : NoteBase
{
public static Tap GenerateElement(string elementName, float exactJudgeTime, BaseElement attach)
{
Tap tap = LeanPool.Spawn(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Tap>();
tap.NewInitialize(elementName, exactJudgeTime);
tap.SetParent(attach);
if (attach.TryGetComponent(out Track track))
{
if (track.trackTimeSubmodule != null)
{
tap.track = track;
tap.trackPositioner.spline = track.trackPathSubmodule.path;
tap.isOnTrack = true;
tap.UpdateNoteInTrack();
}
else
{
throw new System.Exception("如果Note要生成在Track上Track必须有TrackTimeSubmodule组件。");
}
}
else
{
}
return tap;
}
public void NewInitialize(string elementName, float exactJudgeTime)
{
base.NewInitialize(elementName);
this.exactJudgeTime = exactJudgeTime;
this.track = null;
this.isOnTrack = false;
}
}
}