2025-02-02 08:34:54 -05:00
|
|
|
|
using System;
|
2025-01-26 21:10:16 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2025-04-19 18:59:26 +08:00
|
|
|
|
using Ichni.Editor;
|
2025-01-26 21:10:16 -05:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
|
{
|
2025-02-21 14:08:32 -05:00
|
|
|
|
public abstract partial class AnimationBase : GameElement, IHaveTimeDurationSubmodule
|
2025-01-26 21:10:16 -05:00
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
public GameElement animatedObject;
|
2025-01-26 21:10:16 -05:00
|
|
|
|
public FlexibleReturnType animationReturnType;
|
|
|
|
|
|
|
2025-02-08 02:31:39 -05:00
|
|
|
|
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
|
|
|
|
|
|
2025-03-16 01:35:05 -04:00
|
|
|
|
public override void SetDefaultSubmodules()
|
2025-01-26 21:10:16 -05:00
|
|
|
|
{
|
2025-02-02 08:34:54 -05:00
|
|
|
|
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
2025-04-12 23:59:46 +08:00
|
|
|
|
|
2025-01-29 23:49:18 -05:00
|
|
|
|
}
|
2025-04-19 18:59:26 +08:00
|
|
|
|
public override void Initialize(string name, Guid elementGuid, List<string> tags,
|
|
|
|
|
|
bool isFirstGenerated, GameElement parentElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Initialize(name, elementGuid, tags, isFirstGenerated, parentElement);
|
|
|
|
|
|
if (this.parentElement.submoduleList.Where(e => e is TransformSubmodule).Count() == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
LogWindow.Log("AnimationBase must be attached to a GameElement with TransformSubmodule", Color.red);
|
|
|
|
|
|
//OnDelete();
|
|
|
|
|
|
//return;
|
|
|
|
|
|
}
|
2025-01-29 23:49:18 -05:00
|
|
|
|
|
2025-04-19 18:59:26 +08:00
|
|
|
|
}
|
2025-02-21 14:08:32 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新动画
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="songTime">歌曲时间</param>
|
2025-01-27 22:11:24 -05:00
|
|
|
|
protected abstract void UpdateAnimation(float songTime);
|
2025-02-08 02:31:39 -05:00
|
|
|
|
|
2025-01-27 22:11:24 -05:00
|
|
|
|
protected virtual void Update()
|
|
|
|
|
|
{
|
2025-02-14 22:04:21 -05:00
|
|
|
|
if (timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songInformation.songTime))
|
2025-01-27 22:11:24 -05:00
|
|
|
|
{
|
2025-02-14 22:04:21 -05:00
|
|
|
|
UpdateAnimation(EditorManager.instance.songInformation.songTime);
|
2025-01-27 22:11:24 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-02-21 14:08:32 -05:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 施加时间偏移,即移动所有Flexible参数的时间
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="offset"></param>
|
|
|
|
|
|
public virtual void ApplyTimeOffset(float offset)
|
|
|
|
|
|
{
|
|
|
|
|
|
timeDurationSubmodule.startTime += offset;
|
|
|
|
|
|
timeDurationSubmodule.endTime += offset;
|
|
|
|
|
|
}
|
2025-01-26 21:10:16 -05:00
|
|
|
|
}
|
2025-02-08 02:31:39 -05:00
|
|
|
|
|
|
|
|
|
|
namespace Beatmap
|
|
|
|
|
|
{
|
|
|
|
|
|
public abstract class AnimationBase_BM : GameElement_BM
|
|
|
|
|
|
{
|
|
|
|
|
|
public AnimationBase_BM()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public AnimationBase_BM(string elementName, Guid elementGuid, List<string> tags,
|
|
|
|
|
|
GameElement_BM attachedElement) : base(elementName, elementGuid, tags, attachedElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-01-26 21:10:16 -05:00
|
|
|
|
}
|