2025-01-27 22:11:24 -05:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-01-28 11:58:39 -05:00
|
|
|
|
using Lean.Pool;
|
2025-01-27 22:11:24 -05:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
2025-01-28 11:58:39 -05:00
|
|
|
|
namespace Ichni.RhythmGame
|
2025-01-27 22:11:24 -05:00
|
|
|
|
{
|
2025-01-28 11:58:39 -05:00
|
|
|
|
public class Flick : NoteBase
|
2025-01-27 22:11:24 -05:00
|
|
|
|
{
|
2025-01-28 11:58:39 -05:00
|
|
|
|
public List<Vector2> availableFlickDirections;
|
|
|
|
|
|
public static Flick GenerateElement(string elementName, float exactJudgeTime, BaseElement attach, List<Vector2> directions)
|
|
|
|
|
|
{
|
|
|
|
|
|
Flick flick = LeanPool.Spawn(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Flick>();
|
|
|
|
|
|
flick.NewInitialize(elementName, exactJudgeTime);
|
|
|
|
|
|
flick.availableFlickDirections = directions;
|
|
|
|
|
|
flick.SetParent(attach);
|
|
|
|
|
|
|
|
|
|
|
|
if (attach.TryGetComponent(out Track track))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (track.trackTimeSubmodule != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
flick.track = track;
|
|
|
|
|
|
flick.trackPositioner.spline = track.trackPathSubmodule.path;
|
|
|
|
|
|
flick.isOnTrack = true;
|
|
|
|
|
|
flick.UpdateNoteInTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new System.Exception("如果Note要生成在Track上,Track必须有TrackTimeSubmodule组件。");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
|
|
2025-01-28 11:58:39 -05:00
|
|
|
|
return flick;
|
|
|
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
|
|
2025-01-28 11:58:39 -05:00
|
|
|
|
public void NewInitialize(string elementName, float exactJudgeTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.NewInitialize(elementName);
|
|
|
|
|
|
this.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
this.track = null;
|
|
|
|
|
|
this.isOnTrack = false;
|
|
|
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
|
}
|
2025-01-28 11:58:39 -05:00
|
|
|
|
}
|