2025-01-03 12:09:23 +00:00
|
|
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System;
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
[Tool]
|
|
|
|
[GlobalClass]
|
2025-01-08 18:46:17 +00:00
|
|
|
public partial class PlayCameraEffect:Action
|
2025-01-03 12:09:23 +00:00
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public CameraEffect cameraEffect;
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
public VirtualCamera3DSlot cameraSlot;
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
public int cameraSlotIndex = -1;
|
|
|
|
|
|
|
|
[Export]
|
2025-01-08 18:46:17 +00:00
|
|
|
public Selector cameraSlotSelector;
|
2025-01-03 12:09:23 +00:00
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
protected override void _OnTrigger()
|
2025-01-03 12:09:23 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
this.LogInfo( "Camera slot found" );
|
|
|
|
|
2025-01-03 12:09:23 +00:00
|
|
|
resolvedSlot.SetCameraEffect( cameraEffect );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|