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;
|
|
|
|
|
2025-01-21 20:58:56 +00:00
|
|
|
[Export]
|
|
|
|
public bool useActiveCameraSlot = false;
|
|
|
|
|
|
|
|
[ExportGroup("Other Camera Slot")]
|
2025-01-03 12:09:23 +00:00
|
|
|
[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-21 20:58:56 +00:00
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
protected override void _OnTrigger()
|
2025-01-03 12:09:23 +00:00
|
|
|
{
|
2025-01-21 20:58:56 +00:00
|
|
|
var manager = VirtualCamera3DManager.Get();
|
|
|
|
var resolvedSlot = useActiveCameraSlot ? manager.activeSlot : cameraSlot;
|
2025-01-03 12:09:23 +00:00
|
|
|
|
|
|
|
if ( resolvedSlot == null && cameraSlotIndex != -1 )
|
2025-01-21 20:58:56 +00:00
|
|
|
{
|
2025-01-03 12:09:23 +00:00
|
|
|
|
|
|
|
if ( cameraSlotIndex != -1 )
|
|
|
|
{
|
|
|
|
resolvedSlot = manager.GetSlot( cameraSlotIndex );
|
|
|
|
}
|
|
|
|
else if ( cameraSlotSelector != null )
|
|
|
|
{
|
|
|
|
resolvedSlot = Selectors.GetFromDirectChildren<VirtualCamera3DSlot>( manager, cameraSlotSelector );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( resolvedSlot == null )
|
|
|
|
{
|
2025-01-21 20:58:56 +00:00
|
|
|
// this.LogError( "No camera slot found" );
|
|
|
|
|
2025-01-03 12:09:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2025-01-21 20:58:56 +00:00
|
|
|
// this.LogInfo( "Camera slot found" );
|
2025-01-08 18:46:17 +00:00
|
|
|
|
2025-01-03 12:09:23 +00:00
|
|
|
resolvedSlot.SetCameraEffect( cameraEffect );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|