59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial class CameraFieldOfView : AnimationBase
|
|
{
|
|
#region [暴露属性字段与关联] Exposed Fields & References
|
|
public FlexibleFloat fieldOfView;
|
|
public GameCamera targetGameCamera;
|
|
#endregion
|
|
|
|
#region [生命周期与工厂] Lifecycle & Factory
|
|
public static CameraFieldOfView GenerateElement(string elementName, Guid id,
|
|
List<string> tags, bool isFirstGenerated, GameCamera gameCamera, FlexibleFloat fieldOfView)
|
|
{
|
|
CameraFieldOfView camFOV = Instantiate(GameManager.Instance.basePrefabs.emptyObject)
|
|
.AddComponent<CameraFieldOfView>();
|
|
camFOV.Initialize(elementName, id, tags, isFirstGenerated, gameCamera);
|
|
|
|
camFOV.animatedObject = gameCamera;
|
|
camFOV.targetGameCamera = gameCamera;
|
|
|
|
camFOV.fieldOfView = fieldOfView;
|
|
camFOV.animationReturnType = FlexibleReturnType.Before;
|
|
|
|
return camFOV;
|
|
}
|
|
|
|
public override void SetDefaultSubmodules()
|
|
{
|
|
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
|
}
|
|
#endregion
|
|
|
|
#region [核心动画逻辑] Core Animation Logic
|
|
protected override void UpdateAnimation(float songTime, bool forceUpdate)
|
|
{
|
|
fieldOfView.UpdateFlexibleFloat(songTime);
|
|
|
|
if (forceUpdate || fieldOfView.returnType == FlexibleReturnType.MiddleExecuting)
|
|
{
|
|
targetGameCamera.perspectiveAngle = fieldOfView.value;
|
|
targetGameCamera.cam.fieldOfView = fieldOfView.value;
|
|
}
|
|
}
|
|
|
|
public override void ApplyTimeOffset(float offset)
|
|
{
|
|
base.ApplyTimeOffset(offset);
|
|
fieldOfView.animations.ForEach(anim => anim.ApplyTimeOffset(offset));
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
} |