86 lines
2.8 KiB
C#
86 lines
2.8 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
|
|
{
|
|
public FlexibleFloat fieldOfView;
|
|
public GameCamera targetGameCamera;
|
|
|
|
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);
|
|
}
|
|
|
|
protected override void UpdateAnimation(float songTime)
|
|
{
|
|
fieldOfView.UpdateFlexibleFloat(songTime);
|
|
|
|
if (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));
|
|
}
|
|
}
|
|
|
|
public partial class CameraFieldOfView
|
|
{
|
|
public override void SaveBM()
|
|
{
|
|
matchedBM = new CameraFieldOfView_BM(elementName, elementGuid, tags, targetGameCamera.matchedBM as GameCamera_BM, fieldOfView.ConvertToBM());
|
|
}
|
|
}
|
|
|
|
namespace Beatmap
|
|
{
|
|
public partial class CameraFieldOfView_BM : AnimationBase_BM
|
|
{
|
|
public FlexibleFloat_BM fieldOfView;
|
|
|
|
public CameraFieldOfView_BM()
|
|
{
|
|
|
|
}
|
|
|
|
public CameraFieldOfView_BM(string elementName, Guid elementGuid, List<string> tags,
|
|
GameElement_BM attachedElement, FlexibleFloat_BM fieldOfView)
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
|
{
|
|
this.fieldOfView = fieldOfView;
|
|
}
|
|
|
|
public override void ExecuteBM()
|
|
{
|
|
matchedElement = CameraFieldOfView.GenerateElement(elementName, elementGuid, tags, false,
|
|
GetElement(attachedElementGuid) as GameCamera, fieldOfView.ConvertToGameType());
|
|
}
|
|
}
|
|
}
|
|
} |