基础内容-2
Track Percent Point 和 Track Head Point 重构优化 Note基础 特效框架(Effect Submodule 和 Effect基础类),将用于“时间触发型特效容器”与“Note特效容器“
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Lean.Pool;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
/// <summary>
|
||||
/// 在轨道上根据百分比进行运动的点
|
||||
/// </summary>
|
||||
public class TrackPercentPoint : BaseElement
|
||||
{
|
||||
public Track track;
|
||||
public SplinePositioner trackPositioner;
|
||||
public FlexibleFloat trackPercent;
|
||||
|
||||
public static TrackPercentPoint GenerateElement(string elementName, Track track, FlexibleFloat trackPercent)
|
||||
{
|
||||
TrackPercentPoint point = LeanPool.Spawn(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent<TrackPercentPoint>();
|
||||
|
||||
point.NewInitialize(elementName, track, trackPercent);
|
||||
point.SetParent(track);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
private void NewInitialize(string elementName, Track track, FlexibleFloat trackPercent)
|
||||
{
|
||||
base.NewInitialize(elementName);
|
||||
this.track = track;
|
||||
this.trackPositioner = gameObject.AddComponent<SplinePositioner>();
|
||||
this.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
this.trackPercent = trackPercent;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (trackPercent.animations.Count > 0)
|
||||
{
|
||||
trackPercent.UpdateFlexibleFloat(EditorManager.instance.songModule.songTime);
|
||||
if (trackPercent.returnType == FlexibleReturnType.MiddleExecuting)
|
||||
{
|
||||
trackPositioner.SetPercent(trackPercent.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user