update
This commit is contained in:
86
Assets/Scripts/Game/Animations/Camera/CameraFieldOfView.cs
Normal file
86
Assets/Scripts/Game/Animations/Camera/CameraFieldOfView.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
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.gameCamera.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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c20f8d0710209c43be21a05b1d89871
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user