56 lines
1.1 KiB
C#
56 lines
1.1 KiB
C#
|
|
using System.Diagnostics;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using Godot;
|
|
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass]
|
|
public partial class PlayCameraEffect:RJAction
|
|
{
|
|
[Export]
|
|
public CameraEffect cameraEffect;
|
|
|
|
[Export]
|
|
public VirtualCamera3DSlot cameraSlot;
|
|
|
|
[Export]
|
|
public int cameraSlotIndex = -1;
|
|
|
|
[Export]
|
|
public RJSelector cameraSlotSelector;
|
|
|
|
public override void _OnTrigger()
|
|
{
|
|
var resolvedSlot = cameraSlot;
|
|
|
|
if ( resolvedSlot == null && cameraSlotIndex != -1 )
|
|
{
|
|
var manager = Unique<VirtualCamera3DManager>.Get();
|
|
|
|
if ( cameraSlotIndex != -1 )
|
|
{
|
|
resolvedSlot = manager.GetSlot( cameraSlotIndex );
|
|
}
|
|
else if ( cameraSlotSelector != null )
|
|
{
|
|
resolvedSlot = Selectors.GetFromDirectChildren<VirtualCamera3DSlot>( manager, cameraSlotSelector );
|
|
}
|
|
}
|
|
|
|
if ( resolvedSlot == null )
|
|
{
|
|
this.LogError( "No camera slot found" );
|
|
return;
|
|
}
|
|
|
|
resolvedSlot.SetCameraEffect( cameraEffect );
|
|
}
|
|
|
|
|
|
}
|
|
} |