rj-action-library/Runtime/VirtualCameras/VirtualCamera3DSlot.cs

51 lines
1.1 KiB
C#

using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
namespace Rokojori
{
[Tool]
[Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/VirtualCamera3DSlot.svg") ]
[GlobalClass]
public partial class VirtualCamera3DSlot:RJAction
{
[Export]
public RJVirtualCamera3D camera;
[Export]
public float priority;
float _smoothedPriority;
public float smoothedPriority => _smoothedPriority;
Smoother smoother = new Smoother();
public void Update( double delta, VirtualCamera3DManager manager )
{
_smoothedPriority = smoother.SmoothWithCoefficient( _smoothedPriority, priority,
manager.safeSmoothing,
(float) delta, manager.smoothStepDelta );
}
public override void _OnTrigger()
{
var vm = GetParent<VirtualCamera3DManager>();
if ( vm == null )
{
return;
}
vm.SetActiveSlot( this );
}
}
}