Complete C# rewrite with working game in Editor (#6)
* Refactor collectable components to C# and update resource scripts for consistency * Update resource paths and refactor properties for consistency * Refactor UI components to inherit from Control and update node paths for consistency * Update node paths and group assignments for consistency across scenes * Refactor GameManager and PlayerDeathComponent for improved state management and logging; update scene connections for player death handling * Add PhantomCamera components and UI elements for improved scene management; refactor existing components for better integration * Refactor skill components and update resource paths for consistency; enhance skill management in scenes * Add new UID files and update scene configurations for dialogue components; refactor skill management and input handling * Add next level command and refactor player retrieval in GameManager; update scene files for consistency * Add skill upgrade system and refactor skill components for enhanced functionality; update resource paths and configurations * Enhance ChargeProgressBar and Marketplace functionality; add owner exit handling and update skill button states * Refactor ChargeProgressBar and SkillManager; update skill handling and improve component interactions * Refactor player and level configurations; streamline FlipPlayerComponent and reposition Spaceship Enter
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
@tool
|
||||
extends EditorNode3DGizmo
|
||||
|
||||
#var pcam_3d: PhantomCamera3D
|
||||
|
||||
func _redraw() -> void:
|
||||
clear()
|
||||
|
||||
var icon: Material = get_plugin().get_material(get_plugin().get_name(), self)
|
||||
add_unscaled_billboard(icon, 0.035)
|
||||
|
||||
var pcam_3d: PhantomCamera3D = get_node_3d()
|
||||
|
||||
# if pcam_3d.is_following():
|
||||
# _draw_target(pcam_3d, pcam_3d.get_follow_target_position(), "follow_target")
|
||||
# if pcam_3d.is_looking_at():
|
||||
# _draw_target(pcam_3d, pcam_3d.get_look_at_target_position(), "look_at_target")
|
||||
|
||||
if pcam_3d.is_active(): return
|
||||
|
||||
var frustum_lines: PackedVector3Array = PackedVector3Array()
|
||||
var height: float = 0.25
|
||||
var width: float = height * 1.25
|
||||
var forward: float = height * -1.5
|
||||
|
||||
# Trapezoid
|
||||
frustum_lines.push_back(Vector3.ZERO)
|
||||
frustum_lines.push_back(Vector3(-width, height, forward))
|
||||
|
||||
frustum_lines.push_back(Vector3.ZERO)
|
||||
frustum_lines.push_back(Vector3(width, height, forward))
|
||||
|
||||
frustum_lines.push_back(Vector3.ZERO)
|
||||
frustum_lines.push_back(Vector3(-width, -height, forward))
|
||||
|
||||
frustum_lines.push_back(Vector3.ZERO)
|
||||
frustum_lines.push_back(Vector3(width, -height, forward))
|
||||
|
||||
#######
|
||||
# Frame
|
||||
#######
|
||||
## Left
|
||||
frustum_lines.push_back(Vector3(-width, height, forward))
|
||||
frustum_lines.push_back(Vector3(-width, -height, forward))
|
||||
|
||||
## Bottom
|
||||
frustum_lines.push_back(Vector3(-width, -height, forward))
|
||||
frustum_lines.push_back(Vector3(width, -height, forward))
|
||||
|
||||
## Right
|
||||
frustum_lines.push_back(Vector3(width, -height, forward))
|
||||
frustum_lines.push_back(Vector3(width, height, forward))
|
||||
|
||||
## Top
|
||||
frustum_lines.push_back(Vector3(width, height, forward))
|
||||
frustum_lines.push_back(Vector3(-width, height, forward))
|
||||
|
||||
##############
|
||||
# Up Direction
|
||||
##############
|
||||
var up_height: float = height + 0.15
|
||||
var up_width: float = width / 3
|
||||
|
||||
## Left
|
||||
frustum_lines.push_back(Vector3(0, up_height, forward))
|
||||
frustum_lines.push_back(Vector3(-up_width, height, forward))
|
||||
|
||||
## Right
|
||||
frustum_lines.push_back(Vector3(0, up_height, forward))
|
||||
frustum_lines.push_back(Vector3(up_width, height, forward))
|
||||
|
||||
var frustum_material: StandardMaterial3D = get_plugin().get_material("frustum", self)
|
||||
add_lines(frustum_lines, frustum_material, false)
|
||||
|
||||
|
||||
func _draw_target(pcam_3d: Node3D, target_position: Vector3, type: String) -> void:
|
||||
var target_lines: PackedVector3Array = PackedVector3Array()
|
||||
var direction: Vector3 = target_position - pcam_3d.global_position
|
||||
var end_position: Vector3 = pcam_3d.global_basis.z * direction
|
||||
|
||||
target_lines.push_back(Vector3.ZERO)
|
||||
target_lines.push_back(end_position)
|
||||
var target_material: StandardMaterial3D = get_plugin().get_material(type, self)
|
||||
add_lines(target_lines, target_material, false)
|
@@ -0,0 +1 @@
|
||||
uid://cyr6fgximfw6q
|
@@ -0,0 +1,37 @@
|
||||
@tool
|
||||
extends EditorNode3DGizmoPlugin
|
||||
|
||||
const PhantomCamera3DNode: Script = preload("res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_3d.gd")
|
||||
const PhantomCamera3DGizmo: Script = preload("res://addons/phantom_camera/scripts/gizmos/phantom_camera_3d_gizmo.gd")
|
||||
const _icon_texture: Texture2D = preload("res://addons/phantom_camera/icons/phantom_camera_gizmo.svg")
|
||||
var _gizmo_name: String = "PhantomCamera3D"
|
||||
|
||||
var gizmo_name: String: set = set_gizmo_name
|
||||
var _gizmo_icon: Texture2D
|
||||
var _gizmo_spatial_script: Script = PhantomCamera3DNode
|
||||
|
||||
|
||||
func set_gizmo_name(name: String) -> void:
|
||||
_gizmo_name = name
|
||||
|
||||
|
||||
func _get_gizmo_name() -> String:
|
||||
return _gizmo_name
|
||||
|
||||
|
||||
func _has_gizmo(spatial: Node3D) -> bool:
|
||||
return spatial is PhantomCamera3D
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
create_icon_material(gizmo_name, _icon_texture, false, Color.WHITE)
|
||||
create_material("frustum", Color8(252, 127, 127, 255))
|
||||
create_material("follow_target", Color8(185, 58, 89))
|
||||
create_material("look_at_target", Color8(61, 207, 225))
|
||||
|
||||
|
||||
func _create_gizmo(for_node_3d: Node3D) -> EditorNode3DGizmo:
|
||||
if for_node_3d is PhantomCamera3DNode:
|
||||
return PhantomCamera3DGizmo.new()
|
||||
else:
|
||||
return null
|
@@ -0,0 +1 @@
|
||||
uid://bkevga3bx4rfj
|
@@ -0,0 +1,29 @@
|
||||
extends EditorNode3DGizmoPlugin
|
||||
|
||||
var _spatial_script: Script = preload("res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_noise_emitter_3d.gd")
|
||||
var _gizmo_icon: Texture2D = preload("res://addons/phantom_camera/icons/phantom_camera_noise_emitter_gizmo.svg")
|
||||
|
||||
var _gizmo_name: StringName = "PhantomCameraNoiseEmitter"
|
||||
|
||||
func _init() -> void:
|
||||
create_material("main", Color8(252, 127, 127, 255))
|
||||
create_handle_material("handles")
|
||||
create_icon_material(_gizmo_name, _gizmo_icon, false, Color.WHITE)
|
||||
|
||||
|
||||
func _has_gizmo(node: Node3D):
|
||||
return node.get_script() == _spatial_script
|
||||
|
||||
|
||||
func _get_gizmo_name() -> String:
|
||||
return _gizmo_name
|
||||
|
||||
|
||||
func _redraw(gizmo: EditorNode3DGizmo):
|
||||
gizmo.clear()
|
||||
|
||||
var icon: Material = get_material(_gizmo_name, gizmo)
|
||||
gizmo.add_unscaled_billboard(icon, 0.035)
|
||||
|
||||
#var material = get_material("main", gizmo)
|
||||
#gizmo.add_lines(_draw_frustum(), material)
|
@@ -0,0 +1 @@
|
||||
uid://dddokcd2ug05i
|
@@ -0,0 +1,36 @@
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace PhantomCamera.Manager;
|
||||
|
||||
public static class PhantomCameraManager
|
||||
{
|
||||
private static GodotObject? _instance;
|
||||
|
||||
public static GodotObject Instance => _instance ??= Engine.GetSingleton("PhantomCameraManager");
|
||||
|
||||
public static PhantomCamera2D[] PhantomCamera2Ds =>
|
||||
Instance.Call(MethodName.GetPhantomCamera2Ds).AsGodotArray<Node2D>()
|
||||
.Select(node => new PhantomCamera2D(node)).ToArray();
|
||||
|
||||
public static PhantomCamera3D[] PhantomCamera3Ds =>
|
||||
Instance.Call(MethodName.GetPhantomCamera3Ds).AsGodotArray<Node3D>()
|
||||
.Select(node => new PhantomCamera3D(node)).ToArray();
|
||||
|
||||
public static PhantomCameraHost[] PhantomCameraHosts =>
|
||||
Instance.Call(MethodName.GetPhantomCameraHosts).AsGodotArray<Node>()
|
||||
.Select(node => new PhantomCameraHost(node)).ToArray();
|
||||
|
||||
public static PhantomCamera2D[] GetPhantomCamera2Ds() => PhantomCamera2Ds;
|
||||
public static PhantomCamera3D[] GetPhantomCamera3Ds() => PhantomCamera3Ds;
|
||||
public static PhantomCameraHost[] GetPhantomCameraHosts() => PhantomCameraHosts;
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetPhantomCamera2Ds = "get_phantom_camera_2ds";
|
||||
public const string GetPhantomCamera3Ds = "get_phantom_camera_3ds";
|
||||
public const string GetPhantomCameraHosts = "get_phantom_camera_hosts";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://vtj8iqx4bp43
|
23
addons/phantom_camera/scripts/panel/editor.gd
Normal file
23
addons/phantom_camera/scripts/panel/editor.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
#region Onready
|
||||
|
||||
@onready var updater: Control = %UpdateButton
|
||||
@onready var viewfinder: Control = %ViewfinderPanel
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Variables
|
||||
|
||||
var editor_plugin: EditorPlugin
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private Functions
|
||||
|
||||
func _ready():
|
||||
updater.editor_plugin = editor_plugin
|
||||
|
||||
#endregion
|
1
addons/phantom_camera/scripts/panel/editor.gd.uid
Normal file
1
addons/phantom_camera/scripts/panel/editor.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cgfwg3paxkj2x
|
112
addons/phantom_camera/scripts/panel/viewfinder/host_list.gd
Normal file
112
addons/phantom_camera/scripts/panel/viewfinder/host_list.gd
Normal file
@@ -0,0 +1,112 @@
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
#region Constants
|
||||
|
||||
const _constants := preload("res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_constants.gd")
|
||||
const _host_list_item: PackedScene = preload("res://addons/phantom_camera/panel/viewfinder/host_list/host_list_item.tscn")
|
||||
|
||||
#endregion
|
||||
|
||||
signal pcam_host_removed(pcam_host: PhantomCameraHost)
|
||||
|
||||
@onready var _host_list_button: Button = %HostListButton
|
||||
@onready var _host_list_scroll_container: ScrollContainer = %ScrollContainer
|
||||
@onready var _host_list_item_container: VBoxContainer = %HostListContainer
|
||||
|
||||
var _host_list_open: bool = false
|
||||
|
||||
var _bottom_offset_value: float
|
||||
|
||||
var _pcam_host_list: Array[PhantomCameraHost]
|
||||
var _pcam_manager: Node
|
||||
|
||||
var _viewfinder_panel: Control
|
||||
|
||||
#region Private Functions
|
||||
|
||||
func _ready() -> void:
|
||||
_host_list_button.pressed.connect(_host_list_button_pressed)
|
||||
if Engine.has_singleton(_constants.PCAM_MANAGER_NODE_NAME):
|
||||
_pcam_manager = Engine.get_singleton(_constants.PCAM_MANAGER_NODE_NAME)
|
||||
_pcam_manager.pcam_host_removed_from_scene.connect(_remove_pcam_host)
|
||||
|
||||
if not get_parent() is Control: return # To prevent errors when opening the scene on its own
|
||||
_viewfinder_panel = get_parent()
|
||||
_viewfinder_panel.resized.connect(_set_offset_top)
|
||||
|
||||
_host_list_item_container.resized.connect(_set_offset_top)
|
||||
|
||||
|
||||
func _set_offset_top() -> void:
|
||||
offset_top = _set_host_list_size()
|
||||
|
||||
|
||||
func _host_list_button_pressed() -> void:
|
||||
_host_list_open = !_host_list_open
|
||||
|
||||
var tween: Tween = create_tween()
|
||||
var max_duration: float = 0.6
|
||||
|
||||
# 300 being the minimum size of the viewfinder's height
|
||||
var duration: float = clampf(
|
||||
max_duration / (300 / _host_list_item_container.size.y),
|
||||
0.3,
|
||||
max_duration)
|
||||
|
||||
tween.tween_property(self, "offset_top", _set_host_list_size(), duration)\
|
||||
.set_ease(Tween.EASE_OUT)\
|
||||
.set_trans(Tween.TRANS_QUINT)
|
||||
|
||||
|
||||
func _set_host_list_size() -> float:
|
||||
if not _host_list_open:
|
||||
return clampf(
|
||||
_viewfinder_panel.size.y - \
|
||||
_host_list_item_container.size.y - \
|
||||
_host_list_button.size.y - 20,
|
||||
0,
|
||||
INF
|
||||
)
|
||||
else:
|
||||
return (_viewfinder_panel.size.y - _host_list_button.size.y / 2)
|
||||
|
||||
|
||||
func _remove_pcam_host(pcam_host: PhantomCameraHost) -> void:
|
||||
if _pcam_host_list.has(pcam_host):
|
||||
_pcam_host_list.erase(pcam_host)
|
||||
|
||||
var freed_pcam_host: Control
|
||||
for host_list_item_instance in _host_list_item_container.get_children():
|
||||
if not host_list_item_instance.pcam_host == pcam_host: continue
|
||||
freed_pcam_host = host_list_item_instance
|
||||
host_list_item_instance.queue_free()
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
|
||||
func add_pcam_host(pcam_host: PhantomCameraHost, is_default: bool) -> void:
|
||||
if _pcam_host_list.has(pcam_host): return
|
||||
|
||||
_pcam_host_list.append(pcam_host)
|
||||
|
||||
var host_list_item_instance: PanelContainer = _host_list_item.instantiate()
|
||||
var switch_pcam_host_button: Button = host_list_item_instance.get_node("%SwitchPCamHost")
|
||||
if is_default: switch_pcam_host_button.button_pressed = true
|
||||
|
||||
if not pcam_host.tree_exiting.is_connected(_remove_pcam_host):
|
||||
pcam_host.tree_exiting.connect(_remove_pcam_host.bind(pcam_host))
|
||||
|
||||
host_list_item_instance.pcam_host = pcam_host
|
||||
|
||||
_host_list_item_container.add_child(host_list_item_instance)
|
||||
|
||||
|
||||
func clear_pcam_host_list() -> void:
|
||||
_pcam_host_list.clear()
|
||||
|
||||
for host_list_item_instance in _host_list_item_container.get_children():
|
||||
host_list_item_instance.queue_free()
|
||||
|
||||
#endregion
|
@@ -0,0 +1 @@
|
||||
uid://c84cxry3t35ny
|
@@ -0,0 +1,58 @@
|
||||
@tool
|
||||
extends Control
|
||||
|
||||
const button_group_resource: ButtonGroup = preload("res://addons/phantom_camera/panel/viewfinder/host_list/host_list_item_group.tres")
|
||||
const _constants = preload("res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_constants.gd")
|
||||
|
||||
@onready var select_pcam_host: Button = %SelectPCamHost
|
||||
@onready var switch_pcam_host: Button = %SwitchPCamHost
|
||||
|
||||
var pcam_host: PhantomCameraHost:
|
||||
set(value):
|
||||
pcam_host = value
|
||||
if not is_instance_valid(value): return
|
||||
if not pcam_host.renamed.is_connected(_rename_pcam_host):
|
||||
pcam_host.renamed.connect(_rename_pcam_host)
|
||||
pcam_host.has_error.connect(_pcam_host_has_error)
|
||||
get:
|
||||
return pcam_host
|
||||
|
||||
var _pcam_manager: Node
|
||||
|
||||
#region Private fucntions
|
||||
|
||||
func _ready() -> void:
|
||||
switch_pcam_host.button_group = button_group_resource
|
||||
select_pcam_host.pressed.connect(_select_pcam)
|
||||
switch_pcam_host.pressed.connect(_switch_pcam_host)
|
||||
|
||||
if not is_instance_valid(pcam_host): return
|
||||
switch_pcam_host.text = pcam_host.name
|
||||
|
||||
_pcam_host_has_error()
|
||||
|
||||
|
||||
func _pcam_host_has_error() -> void:
|
||||
if pcam_host.show_warning:
|
||||
%ErrorPCamHost.visible = true
|
||||
else:
|
||||
%ErrorPCamHost.visible = false
|
||||
|
||||
|
||||
func _rename_pcam_host() -> void:
|
||||
switch_pcam_host.text = pcam_host.name
|
||||
|
||||
|
||||
func _select_pcam() -> void:
|
||||
EditorInterface.get_selection().clear()
|
||||
EditorInterface.get_selection().add_node(pcam_host)
|
||||
|
||||
|
||||
func _switch_pcam_host() -> void:
|
||||
if not Engine.has_singleton(_constants.PCAM_MANAGER_NODE_NAME): return
|
||||
if not is_instance_valid(_pcam_manager):
|
||||
_pcam_manager = Engine.get_singleton(_constants.PCAM_MANAGER_NODE_NAME)
|
||||
|
||||
_pcam_manager.viewfinder_pcam_host_switch.emit(pcam_host)
|
||||
|
||||
#endregion
|
@@ -0,0 +1 @@
|
||||
uid://bv24ubx8mutw7
|
253
addons/phantom_camera/scripts/phantom_camera/PhantomCamera.cs
Normal file
253
addons/phantom_camera/scripts/phantom_camera/PhantomCamera.cs
Normal file
@@ -0,0 +1,253 @@
|
||||
using Godot;
|
||||
using PhantomCamera.Noise;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace PhantomCamera;
|
||||
|
||||
public enum InactiveUpdateMode
|
||||
{
|
||||
Always,
|
||||
Never
|
||||
}
|
||||
|
||||
public abstract class PhantomCamera
|
||||
{
|
||||
protected readonly GodotObject Node;
|
||||
|
||||
public delegate void BecameActiveEventHandler();
|
||||
public delegate void BecameInactiveEventHandler();
|
||||
public delegate void FollowTargetChangedEventHandler();
|
||||
public delegate void DeadZoneChangedEventHandler();
|
||||
public delegate void TweenStartedEventHandler();
|
||||
public delegate void IsTweeningEventHandler();
|
||||
public delegate void TweenCompletedEventHandler();
|
||||
|
||||
public event BecameActiveEventHandler? BecameActive;
|
||||
public event BecameInactiveEventHandler? BecameInactive;
|
||||
public event FollowTargetChangedEventHandler? FollowTargetChanged;
|
||||
public event DeadZoneChangedEventHandler? DeadZoneChanged;
|
||||
public event TweenStartedEventHandler? TweenStarted;
|
||||
public event IsTweeningEventHandler? IsTweening;
|
||||
public event TweenCompletedEventHandler? TweenCompleted;
|
||||
|
||||
private readonly Callable _callableBecameActive;
|
||||
private readonly Callable _callableBecameInactive;
|
||||
private readonly Callable _callableFollowTargetChanged;
|
||||
private readonly Callable _callableDeadZoneChanged;
|
||||
private readonly Callable _callableTweenStarted;
|
||||
private readonly Callable _callableIsTweening;
|
||||
private readonly Callable _callableTweenCompleted;
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get => (int)Node.Call(MethodName.GetPriority);
|
||||
set => Node.Call(MethodName.SetPriority, value);
|
||||
}
|
||||
|
||||
public bool IsActive => (bool)Node.Call(MethodName.IsActive);
|
||||
|
||||
public bool FollowDamping
|
||||
{
|
||||
get => (bool)Node.Call(MethodName.GetFollowDamping);
|
||||
set => Node.Call(MethodName.SetFollowDamping, value);
|
||||
}
|
||||
|
||||
public bool IsFollowing => (bool)Node.Call(PhantomCamera.MethodName.IsFollowing);
|
||||
|
||||
public float DeadZoneWidth
|
||||
{
|
||||
get => (float)Node.Get(PropertyName.DeadZoneWidth);
|
||||
set => Node.Set(PropertyName.DeadZoneWidth, value);
|
||||
}
|
||||
|
||||
public float DeadZoneHeight
|
||||
{
|
||||
get => (float)Node.Get(PropertyName.DeadZoneHeight);
|
||||
set => Node.Set(PropertyName.DeadZoneHeight, value);
|
||||
}
|
||||
|
||||
public PhantomCameraTween TweenResource
|
||||
{
|
||||
get => new((Resource)Node.Call(MethodName.GetTweenResource));
|
||||
set => Node.Call(MethodName.SetTweenResource, (GodotObject)value.Resource);
|
||||
}
|
||||
|
||||
public bool TweenSkip
|
||||
{
|
||||
get => (bool)Node.Call(MethodName.GetTweenSkip);
|
||||
set => Node.Call(MethodName.SetTweenSkip, value);
|
||||
}
|
||||
|
||||
public float TweenDuration
|
||||
{
|
||||
get => (float)Node.Call(MethodName.GetTweenDuration);
|
||||
set => Node.Call(MethodName.SetTweenDuration, value);
|
||||
}
|
||||
|
||||
public TransitionType TweenTransition
|
||||
{
|
||||
get => (TransitionType)(int)Node.Call(MethodName.GetTweenTransition);
|
||||
set => Node.Call(MethodName.SetTweenTransition, (int)value);
|
||||
}
|
||||
|
||||
public EaseType TweenEase
|
||||
{
|
||||
get => (EaseType)(int)Node.Call(MethodName.GetTweenEase);
|
||||
set => Node.Call(MethodName.SetTweenEase, (int)value);
|
||||
}
|
||||
|
||||
public bool TweenOnLoad
|
||||
{
|
||||
get => (bool)Node.Call(MethodName.GetTweenOnLoad);
|
||||
set => Node.Call(MethodName.SetTweenOnLoad, value);
|
||||
}
|
||||
|
||||
public InactiveUpdateMode InactiveUpdateMode
|
||||
{
|
||||
get => (InactiveUpdateMode)(int)Node.Call(MethodName.GetInactiveUpdateMode);
|
||||
set => Node.Call(MethodName.SetInactiveUpdateMode, (int)value);
|
||||
}
|
||||
|
||||
public int HostLayers
|
||||
{
|
||||
get => (int)Node.Call(MethodName.GetHostLayers);
|
||||
set => Node.Call(MethodName.SetHostLayers, value);
|
||||
}
|
||||
|
||||
public int NoiseEmitterLayer
|
||||
{
|
||||
get => (int)Node.Call(MethodName.GetNoiseEmitterLayer);
|
||||
set => Node.Call(MethodName.SetNoiseEmitterLayer, value);
|
||||
}
|
||||
|
||||
public void TeleportPosition()
|
||||
{
|
||||
Node.Call(MethodName.TeleportPosition);
|
||||
}
|
||||
|
||||
public void SetHostLayersValue(int layer, bool enabled)
|
||||
{
|
||||
Node.Call(MethodName.SetHostLayersValue, layer, enabled);
|
||||
}
|
||||
|
||||
protected PhantomCamera(GodotObject phantomCameraNode)
|
||||
{
|
||||
Node = phantomCameraNode;
|
||||
|
||||
_callableBecameActive = Callable.From(() => BecameActive?.Invoke());
|
||||
_callableBecameInactive = Callable.From(() => BecameInactive?.Invoke());
|
||||
_callableFollowTargetChanged = Callable.From(() => FollowTargetChanged?.Invoke());
|
||||
_callableDeadZoneChanged = Callable.From(() => DeadZoneChanged?.Invoke());
|
||||
_callableTweenStarted = Callable.From(() => TweenStarted?.Invoke());
|
||||
_callableIsTweening = Callable.From(() => IsTweening?.Invoke());
|
||||
_callableTweenCompleted = Callable.From(() => TweenCompleted?.Invoke());
|
||||
|
||||
Node.Connect(SignalName.BecameActive, _callableBecameActive);
|
||||
Node.Connect(SignalName.BecameInactive, _callableBecameInactive);
|
||||
Node.Connect(SignalName.FollowTargetChanged, _callableFollowTargetChanged);
|
||||
Node.Connect(SignalName.DeadZoneChanged, _callableDeadZoneChanged);
|
||||
Node.Connect(SignalName.TweenStarted, _callableTweenStarted);
|
||||
Node.Connect(SignalName.IsTweening, _callableIsTweening);
|
||||
Node.Connect(SignalName.TweenCompleted, _callableTweenCompleted);
|
||||
}
|
||||
|
||||
~PhantomCamera()
|
||||
{
|
||||
Node.Disconnect(SignalName.BecameActive, _callableBecameActive);
|
||||
Node.Disconnect(SignalName.BecameInactive, _callableBecameInactive);
|
||||
Node.Disconnect(SignalName.FollowTargetChanged, _callableFollowTargetChanged);
|
||||
Node.Disconnect(SignalName.DeadZoneChanged, _callableDeadZoneChanged);
|
||||
Node.Disconnect(SignalName.TweenStarted, _callableTweenStarted);
|
||||
Node.Disconnect(SignalName.IsTweening, _callableIsTweening);
|
||||
Node.Disconnect(SignalName.TweenCompleted, _callableTweenCompleted);
|
||||
}
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetFollowMode = "get_follow_mode";
|
||||
public const string IsActive = "is_active";
|
||||
|
||||
public const string GetPriority = "get_priority";
|
||||
public const string SetPriority = "set_priority";
|
||||
|
||||
public const string IsFollowing = "is_following";
|
||||
|
||||
public const string GetFollowTarget = "get_follow_target";
|
||||
public const string SetFollowTarget = "set_follow_target";
|
||||
|
||||
public const string GetFollowTargets = "get_follow_targets";
|
||||
public const string SetFollowTargets = "set_follow_targets";
|
||||
|
||||
public const string TeleportPosition = "teleport_position";
|
||||
|
||||
public const string AppendFollowTargets = "append_follow_targets";
|
||||
public const string AppendFollowTargetsArray = "append_follow_targets_array";
|
||||
public const string EraseFollowTargets = "erase_follow_targets";
|
||||
|
||||
public const string GetFollowPath = "get_follow_path";
|
||||
public const string SetFollowPath = "set_follow_path";
|
||||
|
||||
public const string GetFollowOffset = "get_follow_offset";
|
||||
public const string SetFollowOffset = "set_follow_offset";
|
||||
|
||||
public const string GetFollowDamping = "get_follow_damping";
|
||||
public const string SetFollowDamping = "set_follow_damping";
|
||||
|
||||
public const string GetFollowDampingValue = "get_follow_damping_value";
|
||||
public const string SetFollowDampingValue = "set_follow_damping_value";
|
||||
|
||||
public const string GetFollowAxisLock = "get_follow_axis_lock";
|
||||
public const string SetFollowAxisLock = "set_follow_axis_lock";
|
||||
|
||||
public const string GetTweenResource = "get_tween_resource";
|
||||
public const string SetTweenResource = "set_tween_resource";
|
||||
|
||||
public const string GetTweenSkip = "get_tween_skip";
|
||||
public const string SetTweenSkip = "set_tween_skip";
|
||||
|
||||
public const string GetTweenDuration = "get_tween_duration";
|
||||
public const string SetTweenDuration = "set_tween_duration";
|
||||
|
||||
public const string GetTweenTransition = "get_tween_transition";
|
||||
public const string SetTweenTransition = "set_tween_transition";
|
||||
|
||||
public const string GetTweenEase = "get_tween_ease";
|
||||
public const string SetTweenEase = "set_tween_ease";
|
||||
|
||||
public const string GetTweenOnLoad = "get_tween_on_load";
|
||||
public const string SetTweenOnLoad = "set_tween_on_load";
|
||||
|
||||
public const string GetInactiveUpdateMode = "get_inactive_update_mode";
|
||||
public const string SetInactiveUpdateMode = "set_inactive_update_mode";
|
||||
|
||||
public const string GetHostLayers = "get_host_layers";
|
||||
public const string SetHostLayers = "set_host_layers";
|
||||
public const string SetHostLayersValue = "set_host_layers_value";
|
||||
|
||||
public const string GetNoiseEmitterLayer = "get_noise_emitter_layer";
|
||||
public const string SetNoiseEmitterLayer = "set_noise_emitter_layer";
|
||||
|
||||
public const string EmitNoise = "emit_noise";
|
||||
}
|
||||
|
||||
public static class PropertyName
|
||||
{
|
||||
public const string DeadZoneWidth = "dead_zone_width";
|
||||
public const string DeadZoneHeight = "dead_zone_height";
|
||||
}
|
||||
|
||||
public static class SignalName
|
||||
{
|
||||
public const string BecameActive = "became_active";
|
||||
public const string BecameInactive = "became_inactive";
|
||||
public const string FollowTargetChanged = "follow_target_changed";
|
||||
public const string DeadZoneChanged = "dead_zone_changed";
|
||||
public const string DeadZoneReached = "dead_zone_reached";
|
||||
public const string TweenStarted = "tween_started";
|
||||
public const string IsTweening = "is_tweening";
|
||||
public const string TweenCompleted = "tween_completed";
|
||||
public const string TweenInterrupted = "tween_interrupted";
|
||||
public const string NoiseEmitted = "noise_emitted";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://d3wh0457i0i3
|
351
addons/phantom_camera/scripts/phantom_camera/PhantomCamera2D.cs
Normal file
351
addons/phantom_camera/scripts/phantom_camera/PhantomCamera2D.cs
Normal file
@@ -0,0 +1,351 @@
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using PhantomCamera.Noise;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace PhantomCamera;
|
||||
|
||||
public enum FollowMode2D
|
||||
{
|
||||
None,
|
||||
Glued,
|
||||
Simple,
|
||||
Group,
|
||||
Path,
|
||||
Framed
|
||||
}
|
||||
|
||||
public enum FollowLockAxis2D
|
||||
{
|
||||
None,
|
||||
X,
|
||||
Y,
|
||||
XY
|
||||
}
|
||||
|
||||
public static class PhantomCamera2DExtensions
|
||||
{
|
||||
public static PhantomCamera2D AsPhantomCamera2D(this Node2D node2D)
|
||||
{
|
||||
return new PhantomCamera2D(node2D);
|
||||
}
|
||||
|
||||
public static PhantomCameraNoiseEmitter2D AsPhantomCameraNoiseEmitter2D(this Node2D node2D)
|
||||
{
|
||||
return new PhantomCameraNoiseEmitter2D(node2D);
|
||||
}
|
||||
|
||||
public static PhantomCameraNoise2D AsPhantomCameraNoise2D(this Resource resource)
|
||||
{
|
||||
return new PhantomCameraNoise2D(resource);
|
||||
}
|
||||
}
|
||||
|
||||
public class PhantomCamera2D : PhantomCamera
|
||||
{
|
||||
public Node2D Node2D => (Node2D)Node;
|
||||
|
||||
public delegate void TweenInterruptedEventHandler(Node2D pCam);
|
||||
public delegate void DeadZoneReachedEventHandler(Vector2 side);
|
||||
public delegate void NoiseEmittedEventHandler(Transform2D output);
|
||||
|
||||
public event TweenInterruptedEventHandler? TweenInterrupted;
|
||||
public event DeadZoneReachedEventHandler? DeadZoneReached;
|
||||
public event NoiseEmittedEventHandler? NoiseEmitted;
|
||||
|
||||
private readonly Callable _callableTweenInterrupted;
|
||||
private readonly Callable _callableDeadZoneReached;
|
||||
private readonly Callable _callableNoiseEmitted;
|
||||
|
||||
public Node2D FollowTarget
|
||||
{
|
||||
get => (Node2D)Node2D.Call(PhantomCamera.MethodName.GetFollowTarget);
|
||||
set => Node2D.Call(PhantomCamera.MethodName.SetFollowTarget, value);
|
||||
}
|
||||
|
||||
public Node2D[] FollowTargets
|
||||
{
|
||||
get => Node2D.Call(PhantomCamera.MethodName.GetFollowTargets).AsGodotArray<Node2D>().ToArray();
|
||||
set => Node2D.Call(PhantomCamera.MethodName.SetFollowTargets, new Array<Node2D>(value));
|
||||
}
|
||||
|
||||
public void AppendFollowTargets(Node2D target) => Node2D.Call(PhantomCamera.MethodName.AppendFollowTargets, target);
|
||||
public void AppendFollowTargetsArray(Node2D[] targets) => Node2D.Call(PhantomCamera.MethodName.AppendFollowTargetsArray, targets);
|
||||
public void EraseFollowTargets(Node2D target) => Node2D.Call(PhantomCamera.MethodName.EraseFollowTargets, target);
|
||||
|
||||
public FollowMode2D FollowMode => (FollowMode2D)(int)Node.Call(PhantomCamera.MethodName.GetFollowMode);
|
||||
|
||||
public Path2D FollowPath
|
||||
{
|
||||
get => (Path2D)Node2D.Call(PhantomCamera.MethodName.GetFollowPath);
|
||||
set => Node2D.Call(PhantomCamera.MethodName.SetFollowPath, value);
|
||||
}
|
||||
|
||||
public Vector2 FollowOffset
|
||||
{
|
||||
get => (Vector2)Node2D.Call(PhantomCamera.MethodName.GetFollowOffset);
|
||||
set => Node2D.Call(PhantomCamera.MethodName.SetFollowOffset, value);
|
||||
}
|
||||
|
||||
public Vector2 FollowDampingValue
|
||||
{
|
||||
get => (Vector2)Node2D.Call(PhantomCamera.MethodName.GetFollowDampingValue);
|
||||
set => Node2D.Call(PhantomCamera.MethodName.SetFollowDampingValue, value);
|
||||
}
|
||||
|
||||
public FollowLockAxis2D FollowAxisLock
|
||||
{
|
||||
get => (FollowLockAxis2D)(int)Node2D.Call(PhantomCamera.MethodName.GetFollowAxisLock);
|
||||
set => Node2D.Call(PhantomCamera.MethodName.SetFollowAxisLock, (int)value);
|
||||
}
|
||||
|
||||
public Vector2 Zoom
|
||||
{
|
||||
get => (Vector2)Node2D.Call(MethodName.GetZoom);
|
||||
set => Node2D.Call(MethodName.SetZoom, value);
|
||||
}
|
||||
|
||||
public bool SnapToPixel
|
||||
{
|
||||
get => (bool)Node2D.Call(MethodName.GetSnapToPixel);
|
||||
set => Node2D.Call(MethodName.SetSnapToPixel, value);
|
||||
}
|
||||
|
||||
public bool RotateWithTarget
|
||||
{
|
||||
get => (bool)Node2D.Call(MethodName.GetRotateWithTarget);
|
||||
set => Node2D.Call(MethodName.SetRotateWithTarget, value);
|
||||
}
|
||||
|
||||
public float RotationOffset
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetRotationOffset);
|
||||
set => Node2D.Call(MethodName.SetRotationOffset, value);
|
||||
}
|
||||
|
||||
public bool RotationDamping
|
||||
{
|
||||
get => (bool)Node2D.Call(MethodName.GetRotationDamping);
|
||||
set => Node2D.Call(MethodName.SetRotationDamping, value);
|
||||
}
|
||||
|
||||
public float RotationDampingValue
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetRotationDampingValue);
|
||||
set => Node2D.Call(MethodName.SetRotationDampingValue, value);
|
||||
}
|
||||
|
||||
public int LimitLeft
|
||||
{
|
||||
get => (int)Node2D.Call(MethodName.GetLimitLeft);
|
||||
set => Node2D.Call(MethodName.SetLimitLeft, value);
|
||||
}
|
||||
|
||||
public int LimitTop
|
||||
{
|
||||
get => (int)Node2D.Call(MethodName.GetLimitTop);
|
||||
set => Node2D.Call(MethodName.SetLimitTop, value);
|
||||
}
|
||||
|
||||
public int LimitRight
|
||||
{
|
||||
get => (int)Node2D.Call(MethodName.GetLimitRight);
|
||||
set => Node2D.Call(MethodName.SetLimitRight, value);
|
||||
}
|
||||
|
||||
public int LimitBottom
|
||||
{
|
||||
get => (int)Node2D.Call(MethodName.GetLimitBottom);
|
||||
set => Node2D.Call(MethodName.SetLimitBottom, value);
|
||||
}
|
||||
|
||||
public Vector4I LimitMargin
|
||||
{
|
||||
get => (Vector4I)Node2D.Call(MethodName.GetLimitMargin);
|
||||
set => Node2D.Call(MethodName.SetLimitMargin, value);
|
||||
}
|
||||
|
||||
public bool AutoZoom
|
||||
{
|
||||
get => (bool)Node2D.Call(MethodName.GetAutoZoom);
|
||||
set => Node2D.Call(MethodName.SetAutoZoom, value);
|
||||
}
|
||||
|
||||
public float AutoZoomMin
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetAutoZoomMin);
|
||||
set => Node2D.Call(MethodName.SetAutoZoomMin, value);
|
||||
}
|
||||
|
||||
public float AutoZoomMax
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetAutoZoomMax);
|
||||
set => Node2D.Call(MethodName.SetAutoZoomMax, value);
|
||||
}
|
||||
|
||||
public Vector4 AutoZoomMargin
|
||||
{
|
||||
get => (Vector4)Node2D.Call(MethodName.GetAutoZoomMargin);
|
||||
set => Node2D.Call(MethodName.SetAutoZoomMargin, value);
|
||||
}
|
||||
|
||||
public bool DrawLimits
|
||||
{
|
||||
get => (bool)Node2D.Get(PropertyName.DrawLimits);
|
||||
set => Node2D.Set(PropertyName.DrawLimits, value);
|
||||
}
|
||||
|
||||
public PhantomCameraNoise2D Noise
|
||||
{
|
||||
get => new((Resource)Node2D.Call(MethodName.GetNoise));
|
||||
set => Node2D.Call(MethodName.SetNoise, (GodotObject)value.Resource);
|
||||
}
|
||||
|
||||
public void EmitNoise(Transform2D transform) => Node2D.Call(PhantomCamera.MethodName.EmitNoise, transform);
|
||||
|
||||
public NodePath LimitTarget
|
||||
{
|
||||
get => (NodePath)Node2D.Call(MethodName.GetLimitTarget);
|
||||
set => Node2D.Call(MethodName.SetLimitTarget, value);
|
||||
}
|
||||
|
||||
public static PhantomCamera2D FromScript(string path) => new(GD.Load<GDScript>(path).New().AsGodotObject());
|
||||
public static PhantomCamera2D FromScript(GDScript script) => new(script.New().AsGodotObject());
|
||||
|
||||
public PhantomCamera2D(GodotObject phantomCameraNode) : base(phantomCameraNode)
|
||||
{
|
||||
_callableTweenInterrupted = Callable.From<Node2D>(pCam => TweenInterrupted?.Invoke(pCam));
|
||||
_callableDeadZoneReached = Callable.From((Vector2 side) => DeadZoneReached?.Invoke(side));
|
||||
_callableNoiseEmitted = Callable.From((Transform2D output) => NoiseEmitted?.Invoke(output));
|
||||
|
||||
Node2D.Connect(SignalName.TweenInterrupted, _callableTweenInterrupted);
|
||||
Node2D.Connect(SignalName.DeadZoneReached, _callableDeadZoneReached);
|
||||
Node2D.Connect(SignalName.NoiseEmitted, _callableNoiseEmitted);
|
||||
}
|
||||
|
||||
~PhantomCamera2D()
|
||||
{
|
||||
Node2D.Disconnect(SignalName.TweenInterrupted, _callableTweenInterrupted);
|
||||
Node2D.Disconnect(SignalName.DeadZoneReached, _callableDeadZoneReached);
|
||||
Node2D.Disconnect(SignalName.NoiseEmitted, _callableNoiseEmitted);
|
||||
}
|
||||
|
||||
public void SetLimitTarget(TileMap tileMap)
|
||||
{
|
||||
Node2D.Call(MethodName.SetLimitTarget, tileMap.GetPath());
|
||||
}
|
||||
|
||||
public void SetLimitTarget(TileMapLayer tileMapLayer)
|
||||
{
|
||||
Node2D.Call(MethodName.SetLimitTarget, tileMapLayer.GetPath());
|
||||
}
|
||||
|
||||
public void SetLimitTarget(CollisionShape2D shape2D)
|
||||
{
|
||||
Node2D.Call(MethodName.SetLimitTarget, shape2D.GetPath());
|
||||
}
|
||||
|
||||
public LimitTargetQueryResult? GetLimitTarget()
|
||||
{
|
||||
var result = (NodePath)Node2D.Call(MethodName.GetLimitTarget);
|
||||
return result.IsEmpty ? null : new LimitTargetQueryResult(Node2D.GetNode(result));
|
||||
}
|
||||
|
||||
public void SetLimit(Side side, int value)
|
||||
{
|
||||
Node2D.Call(MethodName.SetLimit, (int)side, value);
|
||||
}
|
||||
|
||||
public int GetLimit(Side side)
|
||||
{
|
||||
return (int)Node2D.Call(MethodName.GetLimit, (int)side);
|
||||
}
|
||||
|
||||
public new static class MethodName
|
||||
{
|
||||
public const string GetZoom = "get_zoom";
|
||||
public const string SetZoom = "set_zoom";
|
||||
|
||||
public const string GetSnapToPixel = "get_snap_to_pixel";
|
||||
public const string SetSnapToPixel = "set_snap_to_pixel";
|
||||
|
||||
public const string GetRotateWithTarget = "get_rotate_with_target";
|
||||
public const string SetRotateWithTarget = "set_rotate_with_target";
|
||||
|
||||
public const string GetRotationOffset = "get_rotation_offset";
|
||||
public const string SetRotationOffset = "set_rotation_offset";
|
||||
|
||||
public const string GetRotationDamping = "get_rotation_damping";
|
||||
public const string SetRotationDamping = "set_rotation_damping";
|
||||
|
||||
public const string GetRotationDampingValue = "get_rotation_damping_value";
|
||||
public const string SetRotationDampingValue = "set_rotation_damping_value";
|
||||
|
||||
public const string GetLimit = "get_limit";
|
||||
public const string SetLimit = "set_limit";
|
||||
|
||||
public const string GetLimitLeft = "get_limit_left";
|
||||
public const string SetLimitLeft = "set_limit_left";
|
||||
|
||||
public const string GetLimitTop = "get_limit_top";
|
||||
public const string SetLimitTop = "set_limit_top";
|
||||
|
||||
public const string GetLimitRight = "get_limit_right";
|
||||
public const string SetLimitRight = "set_limit_right";
|
||||
|
||||
public const string GetLimitBottom = "get_limit_bottom";
|
||||
public const string SetLimitBottom = "set_limit_bottom";
|
||||
|
||||
public const string GetLimitTarget = "get_limit_target";
|
||||
public const string SetLimitTarget = "set_limit_target";
|
||||
|
||||
public const string GetLimitMargin = "get_limit_margin";
|
||||
public const string SetLimitMargin = "set_limit_margin";
|
||||
|
||||
public const string GetAutoZoom = "get_auto_zoom";
|
||||
public const string SetAutoZoom = "set_auto_zoom";
|
||||
|
||||
public const string GetAutoZoomMin = "get_auto_zoom_min";
|
||||
public const string SetAutoZoomMin = "set_auto_zoom_min";
|
||||
|
||||
public const string GetAutoZoomMax = "get_auto_zoom_max";
|
||||
public const string SetAutoZoomMax = "set_auto_zoom_max";
|
||||
|
||||
public const string GetAutoZoomMargin = "get_auto_zoom_margin";
|
||||
public const string SetAutoZoomMargin = "set_auto_zoom_margin";
|
||||
|
||||
public const string GetNoise = "get_noise";
|
||||
public const string SetNoise = "set_noise";
|
||||
}
|
||||
|
||||
public new static class PropertyName
|
||||
{
|
||||
public const string DrawLimits = "draw_limits";
|
||||
}
|
||||
}
|
||||
|
||||
public class LimitTargetQueryResult(GodotObject godotObject)
|
||||
{
|
||||
public bool IsTileMap => godotObject.IsClass("TileMap");
|
||||
|
||||
public bool IsTileMapLayer => godotObject.IsClass("TileMapLayer");
|
||||
|
||||
public bool IsCollisionShape2D => godotObject.IsClass("CollisionShape2D");
|
||||
|
||||
public TileMap? AsTileMap()
|
||||
{
|
||||
return IsTileMap ? (TileMap)godotObject : null;
|
||||
}
|
||||
|
||||
public TileMapLayer? AsTileMapLayer()
|
||||
{
|
||||
return IsTileMapLayer ? (TileMapLayer)godotObject : null;
|
||||
}
|
||||
|
||||
public CollisionShape2D? AsCollisionShape2D()
|
||||
{
|
||||
return IsCollisionShape2D ? (CollisionShape2D)godotObject : null;
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://c38e5qhsf3fk3
|
493
addons/phantom_camera/scripts/phantom_camera/PhantomCamera3D.cs
Normal file
493
addons/phantom_camera/scripts/phantom_camera/PhantomCamera3D.cs
Normal file
@@ -0,0 +1,493 @@
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using PhantomCamera.Noise;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace PhantomCamera;
|
||||
|
||||
public enum LookAtMode
|
||||
{
|
||||
None,
|
||||
Mimic,
|
||||
Simple,
|
||||
Group
|
||||
}
|
||||
|
||||
public enum FollowMode3D
|
||||
{
|
||||
None,
|
||||
Glued,
|
||||
Simple,
|
||||
Group,
|
||||
Path,
|
||||
Framed,
|
||||
ThirdPerson
|
||||
}
|
||||
|
||||
public enum FollowLockAxis3D
|
||||
{
|
||||
None,
|
||||
X,
|
||||
Y,
|
||||
Z,
|
||||
XY,
|
||||
XZ,
|
||||
YZ,
|
||||
XYZ
|
||||
}
|
||||
|
||||
public static class PhantomCamera3DExtensions
|
||||
{
|
||||
public static PhantomCamera3D AsPhantomCamera3D(this Node3D node3D)
|
||||
{
|
||||
return new PhantomCamera3D(node3D);
|
||||
}
|
||||
|
||||
public static PhantomCameraNoiseEmitter3D AsPhantomCameraNoiseEmitter3D(this Node3D node3D)
|
||||
{
|
||||
return new PhantomCameraNoiseEmitter3D(node3D);
|
||||
}
|
||||
|
||||
public static PhantomCameraNoise3D AsPhantomCameraNoise3D(this Resource resource)
|
||||
{
|
||||
return new PhantomCameraNoise3D(resource);
|
||||
}
|
||||
|
||||
public static Camera3DResource AsCamera3DResource(this Resource resource)
|
||||
{
|
||||
return new Camera3DResource(resource);
|
||||
}
|
||||
|
||||
public static Vector3 GetThirdPersonRotation(this PhantomCamera3D pCam3D) =>
|
||||
(Vector3)pCam3D.Node3D.Call(PhantomCamera3D.MethodName.GetThirdPersonRotation);
|
||||
|
||||
public static void SetThirdPersonRotation(this PhantomCamera3D pCam3D, Vector3 rotation) =>
|
||||
pCam3D.Node3D.Call(PhantomCamera3D.MethodName.SetThirdPersonRotation, rotation);
|
||||
|
||||
public static Vector3 GetThirdPersonRotationDegrees(this PhantomCamera3D pCam3D) =>
|
||||
(Vector3)pCam3D.Node3D.Call(PhantomCamera3D.MethodName.GetThirdPersonRotationDegrees);
|
||||
|
||||
public static void SetThirdPersonDegrees(this PhantomCamera3D pCam3D, Vector3 rotation) =>
|
||||
pCam3D.Node3D.Call(PhantomCamera3D.MethodName.SetThirdPersonRotationDegrees, rotation);
|
||||
|
||||
public static Quaternion GetThirdPersonQuaternion(this PhantomCamera3D pCam3D) =>
|
||||
(Quaternion)pCam3D.Node3D.Call(PhantomCamera3D.MethodName.GetThirdPersonQuaternion);
|
||||
|
||||
public static void SetThirdPersonQuaternion(this PhantomCamera3D pCam3D, Quaternion quaternion) =>
|
||||
pCam3D.Node3D.Call(PhantomCamera3D.MethodName.SetThirdPersonQuaternion, quaternion);
|
||||
|
||||
}
|
||||
|
||||
public class PhantomCamera3D : PhantomCamera
|
||||
{
|
||||
public Node3D Node3D => (Node3D)Node;
|
||||
|
||||
public delegate void LookAtTargetChangedEventHandler();
|
||||
public delegate void DeadZoneReachedEventHandler();
|
||||
public delegate void Camera3DResourceChangedEventHandler();
|
||||
public delegate void Camera3DResourcePropertyChangedEventHandler(StringName property, Variant value);
|
||||
public delegate void TweenInterruptedEventHandler(Node3D pCam);
|
||||
public delegate void NoiseEmittedEventHandler(Transform3D output);
|
||||
|
||||
public event LookAtTargetChangedEventHandler? LookAtTargetChanged;
|
||||
public event DeadZoneReachedEventHandler? DeadZoneReached;
|
||||
public event Camera3DResourceChangedEventHandler? Camera3DResourceChanged;
|
||||
public event Camera3DResourcePropertyChangedEventHandler? Camera3DResourcePropertyChanged;
|
||||
public event TweenInterruptedEventHandler? TweenInterrupted;
|
||||
public event NoiseEmittedEventHandler? NoiseEmitted;
|
||||
|
||||
private readonly Callable _callableLookAtTargetChanged;
|
||||
private readonly Callable _callableDeadZoneReached;
|
||||
private readonly Callable _callableCamera3DResourceChanged;
|
||||
private readonly Callable _callableCamera3DResourcePropertyChanged;
|
||||
private readonly Callable _callableTweenInterrupted;
|
||||
private readonly Callable _callableNoiseEmitted;
|
||||
|
||||
public Node3D FollowTarget
|
||||
{
|
||||
get => (Node3D)Node3D.Call(PhantomCamera.MethodName.GetFollowTarget);
|
||||
set => Node3D.Call(PhantomCamera.MethodName.SetFollowTarget, value);
|
||||
}
|
||||
|
||||
public Node3D[] FollowTargets
|
||||
{
|
||||
get => Node3D.Call(PhantomCamera.MethodName.GetFollowTargets).AsGodotArray<Node3D>().ToArray();
|
||||
set => Node3D.Call(PhantomCamera.MethodName.SetFollowTargets, new Array<Node3D>(value));
|
||||
}
|
||||
|
||||
public void AppendFollowTarget(Node3D target) => Node3D.Call(PhantomCamera.MethodName.AppendFollowTargets, target);
|
||||
public void AppendFollowTargetArray(Node3D[] targets) => Node3D.Call(PhantomCamera.MethodName.AppendFollowTargetsArray, targets);
|
||||
public void EraseFollowTarget(Node3D target) => Node3D.Call(PhantomCamera.MethodName.EraseFollowTargets, target);
|
||||
|
||||
public FollowMode3D FollowMode => (FollowMode3D)(int)Node.Call(PhantomCamera.MethodName.GetFollowMode);
|
||||
|
||||
public Path3D FollowPath
|
||||
{
|
||||
get => (Path3D)Node3D.Call(PhantomCamera.MethodName.GetFollowPath);
|
||||
set => Node3D.Call(PhantomCamera.MethodName.SetFollowPath, value);
|
||||
}
|
||||
|
||||
public Vector3 FollowOffset
|
||||
{
|
||||
get => (Vector3)Node3D.Call(PhantomCamera.MethodName.GetFollowOffset);
|
||||
set => Node3D.Call(PhantomCamera.MethodName.SetFollowOffset, value);
|
||||
}
|
||||
|
||||
public Vector3 FollowDampingValue
|
||||
{
|
||||
get => (Vector3)Node3D.Call(PhantomCamera.MethodName.GetFollowDampingValue);
|
||||
set => Node3D.Call(PhantomCamera.MethodName.SetFollowDampingValue, value);
|
||||
}
|
||||
|
||||
public FollowLockAxis3D FollowAxisLock
|
||||
{
|
||||
get => (FollowLockAxis3D)(int)Node3D.Call(PhantomCamera.MethodName.GetFollowAxisLock);
|
||||
set => Node3D.Call(PhantomCamera.MethodName.SetFollowAxisLock, (int)value);
|
||||
}
|
||||
|
||||
public LookAtMode LookAtMode => (LookAtMode)(int)Node3D.Call(MethodName.GetLookAtMode);
|
||||
|
||||
public Camera3DResource Camera3DResource
|
||||
{
|
||||
get => new((Resource)Node3D.Call(MethodName.GetCamera3DResource));
|
||||
set => Node3D.Call(MethodName.SetCamera3DResource, value.Resource);
|
||||
}
|
||||
|
||||
public float SpringLength
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetSpringLength);
|
||||
set => Node3D.Call(MethodName.SetSpringLength, value);
|
||||
}
|
||||
|
||||
public float VerticalRotationOffset
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetVerticalRotationOffset);
|
||||
set => Node3D.Call(MethodName.SetVerticalRotationOffset, value);
|
||||
}
|
||||
|
||||
public float HorizontalRotationOffset
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetHorizontalRotationOffset);
|
||||
set => Node3D.Call(MethodName.SetHorizontalRotationOffset, value);
|
||||
}
|
||||
|
||||
public float FollowDistance
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetFollowDistance);
|
||||
set => Node3D.Call(MethodName.SetFollowDistance, value);
|
||||
}
|
||||
|
||||
public bool AutoFollowDistance
|
||||
{
|
||||
get => (bool)Node3D.Call(MethodName.GetAutoFollowDistance);
|
||||
set => Node3D.Call(MethodName.SetAutoFollowDistance, value);
|
||||
}
|
||||
|
||||
public float AutoFollowDistanceMin
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetAutoFollowDistanceMin);
|
||||
set => Node3D.Call(MethodName.SetAutoFollowDistanceMin, value);
|
||||
}
|
||||
|
||||
public float AutoFollowDistanceMax
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetAutoFollowDistanceMax);
|
||||
set => Node3D.Call(MethodName.SetAutoFollowDistanceMax, value);
|
||||
}
|
||||
|
||||
public float AutoFollowDistanceDivisor
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetAutoFollowDistanceDivisor);
|
||||
set => Node3D.Call(MethodName.SetAutoFollowDistanceDivisor, value);
|
||||
}
|
||||
|
||||
public Node3D LookAtTarget
|
||||
{
|
||||
get => (Node3D)Node3D.Call(MethodName.GetLookAtTarget);
|
||||
set => Node3D.Call(MethodName.SetLookAtTarget, value);
|
||||
}
|
||||
|
||||
public Node3D[] LookAtTargets
|
||||
{
|
||||
get => Node3D.Call(MethodName.GetLookAtTargets).AsGodotArray<Node3D>().ToArray();
|
||||
set => Node3D.Call(MethodName.SetLookAtTargets, new Array<Node3D>(value));
|
||||
}
|
||||
|
||||
public bool IsLooking => (bool)Node3D.Call(MethodName.IsLooking);
|
||||
|
||||
public int CollisionMask
|
||||
{
|
||||
get => (int)Node3D.Call(MethodName.GetCollisionMask);
|
||||
set => Node3D.Call(MethodName.SetCollisionMask, value);
|
||||
}
|
||||
|
||||
public void SetCollisionMaskValue(int maskLayer, bool enable) =>
|
||||
Node3D.Call(MethodName.SetCollisionMaskValue, maskLayer, enable);
|
||||
|
||||
public Shape3D Shape
|
||||
{
|
||||
get => (Shape3D)Node3D.Call(MethodName.GetShape);
|
||||
set => Node3D.Call(MethodName.SetShape, value);
|
||||
}
|
||||
|
||||
public float Margin
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetMargin);
|
||||
set => Node3D.Call(MethodName.SetMargin, value);
|
||||
}
|
||||
|
||||
public Vector3 LookAtOffset
|
||||
{
|
||||
get => (Vector3)Node3D.Call(MethodName.GetLookAtOffset);
|
||||
set => Node3D.Call(MethodName.SetLookAtOffset, value);
|
||||
}
|
||||
|
||||
public bool LookAtDamping
|
||||
{
|
||||
get => (bool)Node3D.Call(MethodName.GetLookAtDamping);
|
||||
set => Node3D.Call(MethodName.SetLookAtDamping, value);
|
||||
}
|
||||
|
||||
public float LookAtDampingValue
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetLookAtDampingValue);
|
||||
set => Node3D.Call(MethodName.SetLookAtDampingValue, value);
|
||||
}
|
||||
|
||||
public Node3D Up
|
||||
{
|
||||
get => (Node3D)Node3D.Call(MethodName.GetUp);
|
||||
set => Node3D.Call(MethodName.SetUp, value);
|
||||
}
|
||||
|
||||
public Vector3 UpTarget
|
||||
{
|
||||
get => (Vector3)Node3D.Call(MethodName.GetUpTarget);
|
||||
set => Node3D.Call(MethodName.SetUpTarget, value);
|
||||
}
|
||||
|
||||
public int CullMask
|
||||
{
|
||||
get => (int)Node3D.Call(MethodName.GetCullMask);
|
||||
set => Node3D.Call(MethodName.SetCullMask, value);
|
||||
}
|
||||
|
||||
public float HOffset
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetHOffset);
|
||||
set => Node3D.Call(MethodName.SetHOffset, value);
|
||||
}
|
||||
|
||||
public float VOffset
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetVOffset);
|
||||
set => Node3D.Call(MethodName.SetVOffset, value);
|
||||
}
|
||||
|
||||
public ProjectionType Projection
|
||||
{
|
||||
get => (ProjectionType)(int)Node3D.Call(MethodName.GetProjection);
|
||||
set => Node3D.Call(MethodName.SetProjection, (int)value);
|
||||
}
|
||||
|
||||
public float Fov
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetFov);
|
||||
set => Node3D.Call(MethodName.SetFov, value);
|
||||
}
|
||||
|
||||
public float Size
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetSize);
|
||||
set => Node3D.Call(MethodName.SetSize, value);
|
||||
}
|
||||
|
||||
public Vector2 FrustumOffset
|
||||
{
|
||||
get => (Vector2)Node3D.Call(MethodName.GetFrustumOffset);
|
||||
set => Node3D.Call(MethodName.SetFrustumOffset, value);
|
||||
}
|
||||
|
||||
public float Far
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetFar);
|
||||
set => Node3D.Call(MethodName.SetFar, value);
|
||||
}
|
||||
|
||||
public float Near
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetNear);
|
||||
set => Node3D.Call(MethodName.SetNear, value);
|
||||
}
|
||||
|
||||
public Environment Environment
|
||||
{
|
||||
get => (Environment)Node3D.Call(MethodName.GetEnvironment);
|
||||
set => Node3D.Call(MethodName.SetEnvironment, value);
|
||||
}
|
||||
|
||||
public CameraAttributes Attributes
|
||||
{
|
||||
get => (CameraAttributes)Node3D.Call(MethodName.GetAttributes);
|
||||
set => Node3D.Call(MethodName.SetAttributes, value);
|
||||
}
|
||||
|
||||
public PhantomCameraNoise3D Noise
|
||||
{
|
||||
get => new((Resource)Node3D.Call(MethodName.GetNoise));
|
||||
set => Node3D.Call(MethodName.SetNoise, (GodotObject)value.Resource);
|
||||
}
|
||||
|
||||
public void EmitNoise(Transform3D transform) => Node3D.Call(PhantomCamera.MethodName.EmitNoise, transform);
|
||||
|
||||
public static PhantomCamera3D FromScript(string path) => new(GD.Load<GDScript>(path).New().AsGodotObject());
|
||||
public static PhantomCamera3D FromScript(GDScript script) => new(script.New().AsGodotObject());
|
||||
|
||||
public PhantomCamera3D(GodotObject phantomCamera3DNode) : base(phantomCamera3DNode)
|
||||
{
|
||||
_callableLookAtTargetChanged = Callable.From(() => LookAtTargetChanged?.Invoke());
|
||||
_callableDeadZoneReached = Callable.From(() => DeadZoneReached?.Invoke());
|
||||
_callableCamera3DResourceChanged = Callable.From(() => Camera3DResourceChanged?.Invoke());
|
||||
_callableCamera3DResourcePropertyChanged = Callable.From((StringName property, Variant value) =>
|
||||
Camera3DResourcePropertyChanged?.Invoke(property, value));
|
||||
_callableTweenInterrupted = Callable.From<Node3D>(pCam => TweenInterrupted?.Invoke(pCam));
|
||||
_callableNoiseEmitted = Callable.From((Transform3D output) => NoiseEmitted?.Invoke(output));
|
||||
|
||||
Node3D.Connect(SignalName.LookAtTargetChanged, _callableLookAtTargetChanged);
|
||||
Node3D.Connect(PhantomCamera.SignalName.DeadZoneReached, _callableDeadZoneReached);
|
||||
Node3D.Connect(SignalName.Camera3DResourceChanged, _callableCamera3DResourceChanged);
|
||||
Node3D.Connect(SignalName.Camera3DResourcePropertyChanged, _callableCamera3DResourcePropertyChanged);
|
||||
Node3D.Connect(PhantomCamera.SignalName.TweenInterrupted, _callableTweenInterrupted);
|
||||
Node3D.Connect(PhantomCamera.SignalName.NoiseEmitted, _callableNoiseEmitted);
|
||||
}
|
||||
|
||||
~PhantomCamera3D()
|
||||
{
|
||||
Node3D.Disconnect(SignalName.LookAtTargetChanged, _callableLookAtTargetChanged);
|
||||
Node3D.Disconnect(PhantomCamera.SignalName.DeadZoneReached, _callableDeadZoneReached);
|
||||
Node3D.Disconnect(SignalName.Camera3DResourceChanged, _callableCamera3DResourceChanged);
|
||||
Node3D.Disconnect(SignalName.Camera3DResourcePropertyChanged, _callableCamera3DResourcePropertyChanged);
|
||||
Node3D.Disconnect(PhantomCamera.SignalName.TweenInterrupted, _callableTweenInterrupted);
|
||||
Node3D.Disconnect(PhantomCamera.SignalName.NoiseEmitted, _callableNoiseEmitted);
|
||||
}
|
||||
|
||||
public new static class MethodName
|
||||
{
|
||||
public const string GetLookAtMode = "get_look_at_mode";
|
||||
|
||||
public const string GetCamera3DResource = "get_camera_3d_resource";
|
||||
public const string SetCamera3DResource = "set_camera_3d_resource";
|
||||
|
||||
public const string GetThirdPersonRotation = "get_third_person_rotation";
|
||||
public const string SetThirdPersonRotation = "set_third_person_rotation";
|
||||
|
||||
public const string GetThirdPersonRotationDegrees = "get_third_person_rotation_degrees";
|
||||
public const string SetThirdPersonRotationDegrees = "set_third_person_rotation_degrees";
|
||||
|
||||
public const string GetThirdPersonQuaternion = "get_third_person_quaternion";
|
||||
public const string SetThirdPersonQuaternion = "set_third_person_quaternion";
|
||||
|
||||
public const string GetVerticalRotationOffset = "get_vertical_rotation_offset";
|
||||
public const string SetVerticalRotationOffset = "set_vertical_rotation_offset";
|
||||
|
||||
public const string GetHorizontalRotationOffset = "get_horizontal_rotation_offset";
|
||||
public const string SetHorizontalRotationOffset = "set_horizontal_rotation_offset";
|
||||
|
||||
public const string GetSpringLength = "get_spring_length";
|
||||
public const string SetSpringLength = "set_spring_length";
|
||||
|
||||
public const string GetFollowDistance = "get_follow_distance";
|
||||
public const string SetFollowDistance = "set_follow_distance";
|
||||
|
||||
public const string GetAutoFollowDistance = "get_auto_follow_distance";
|
||||
public const string SetAutoFollowDistance = "set_auto_follow_distance";
|
||||
|
||||
public const string GetAutoFollowDistanceMin = "get_auto_follow_distance_min";
|
||||
public const string SetAutoFollowDistanceMin = "set_auto_follow_distance_min";
|
||||
|
||||
public const string GetAutoFollowDistanceMax = "get_auto_follow_distance_max";
|
||||
public const string SetAutoFollowDistanceMax = "set_auto_follow_distance_max";
|
||||
|
||||
public const string GetAutoFollowDistanceDivisor = "get_auto_follow_distance_divisor";
|
||||
public const string SetAutoFollowDistanceDivisor = "set_auto_follow_distance_divisor";
|
||||
|
||||
public const string GetLookAtTarget = "get_look_at_target";
|
||||
public const string SetLookAtTarget = "set_look_at_target";
|
||||
|
||||
public const string GetLookAtTargets = "get_look_at_targets";
|
||||
public const string SetLookAtTargets = "set_look_at_targets";
|
||||
|
||||
public const string IsLooking = "is_looking";
|
||||
|
||||
public const string GetUp = "get_up";
|
||||
public const string SetUp = "set_up";
|
||||
|
||||
public const string GetUpTarget = "get_up_target";
|
||||
public const string SetUpTarget = "set_up_target";
|
||||
|
||||
public const string GetCollisionMask = "get_collision_mask";
|
||||
public const string SetCollisionMask = "set_collision_mask";
|
||||
|
||||
public const string SetCollisionMaskValue = "set_collision_mask_value";
|
||||
|
||||
public const string GetShape = "get_shape";
|
||||
public const string SetShape = "set_shape";
|
||||
|
||||
public const string GetMargin = "get_margin";
|
||||
public const string SetMargin = "set_margin";
|
||||
|
||||
public const string GetLookAtOffset = "get_look_at_offset";
|
||||
public const string SetLookAtOffset = "set_look_at_offset";
|
||||
|
||||
public const string GetLookAtDamping = "get_look_at_damping";
|
||||
public const string SetLookAtDamping = "set_look_at_damping";
|
||||
|
||||
public const string GetLookAtDampingValue = "get_look_at_damping_value";
|
||||
public const string SetLookAtDampingValue = "set_look_at_damping_value";
|
||||
|
||||
public const string GetCullMask = "get_cull_mask";
|
||||
public const string SetCullMask = "set_cull_mask";
|
||||
|
||||
public const string GetHOffset = "get_h_offset";
|
||||
public const string SetHOffset = "set_h_offset";
|
||||
|
||||
public const string GetVOffset = "get_v_offset";
|
||||
public const string SetVOffset = "set_v_offset";
|
||||
|
||||
public const string GetProjection = "get_projection";
|
||||
public const string SetProjection = "set_projection";
|
||||
|
||||
public const string GetFov = "get_fov";
|
||||
public const string SetFov = "set_fov";
|
||||
|
||||
public const string GetSize = "get_size";
|
||||
public const string SetSize = "set_size";
|
||||
|
||||
public const string GetFrustumOffset = "get_frustum_offset";
|
||||
public const string SetFrustumOffset = "set_frustum_offset";
|
||||
|
||||
public const string GetFar = "get_far";
|
||||
public const string SetFar = "set_far";
|
||||
|
||||
public const string GetNear = "get_near";
|
||||
public const string SetNear = "set_near";
|
||||
|
||||
public const string GetEnvironment = "get_environment";
|
||||
public const string SetEnvironment = "set_environment";
|
||||
|
||||
public const string GetAttributes = "get_attributes";
|
||||
public const string SetAttributes = "set_attributes";
|
||||
|
||||
public const string GetNoise = "get_noise";
|
||||
public const string SetNoise = "set_noise";
|
||||
}
|
||||
|
||||
public new static class SignalName
|
||||
{
|
||||
public const string LookAtTargetChanged = "look_at_target_changed";
|
||||
public const string Camera3DResourceChanged = "camera_3d_resource_changed";
|
||||
public const string Camera3DResourcePropertyChanged = "camera_3d_resource_property_changed";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://bx3g7jxtwhi04
|
@@ -0,0 +1,83 @@
|
||||
using Godot;
|
||||
|
||||
namespace PhantomCamera.Noise;
|
||||
|
||||
public class PhantomCameraNoiseEmitter2D(GodotObject node)
|
||||
{
|
||||
public Node2D Node2D = (Node2D)node;
|
||||
|
||||
public PhantomCameraNoise2D Noise
|
||||
{
|
||||
get => new((Resource)Node2D.Call(MethodName.GetNoise));
|
||||
set => Node2D.Call(MethodName.SetNoise, (GodotObject)value.Resource);
|
||||
}
|
||||
|
||||
public bool Continuous
|
||||
{
|
||||
get => (bool)Node2D.Call(MethodName.GetContinuous);
|
||||
set => Node2D.Call(MethodName.SetContinuous, value);
|
||||
}
|
||||
|
||||
public float GrowthTime
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetGrowthTime);
|
||||
set => Node2D.Call(MethodName.SetGrowthTime, value);
|
||||
}
|
||||
|
||||
public float Duration
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetDuration);
|
||||
set => Node2D.Call(MethodName.SetDuration, value);
|
||||
}
|
||||
|
||||
public float DecayTime
|
||||
{
|
||||
get => (float)Node2D.Call(MethodName.GetDecayTime);
|
||||
set => Node2D.Call(MethodName.SetDecayTime, value);
|
||||
}
|
||||
|
||||
public int NoiseEmitterLayer
|
||||
{
|
||||
get => (int)Node2D.Call(MethodName.GetNoiseEmitterLayer);
|
||||
set => Node2D.Call(MethodName.SetNoiseEmitterLayer, value);
|
||||
}
|
||||
|
||||
public void SetNoiseEmitterLayerValue(int layer, bool value) =>
|
||||
Node2D.Call(MethodName.SetNoiseEmitterLayerValue, layer, value);
|
||||
|
||||
public void Emit() => Node2D.Call(MethodName.Emit);
|
||||
|
||||
public bool IsEmitting() => (bool)Node2D.Call(MethodName.IsEmitting);
|
||||
|
||||
public void Stop() => Node2D.Call(MethodName.Stop);
|
||||
|
||||
public void Toggle() => Node2D.Call(MethodName.Toggle);
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetNoise = "get_noise";
|
||||
public const string SetNoise = "set_noise";
|
||||
|
||||
public const string GetContinuous = "get_continuous";
|
||||
public const string SetContinuous = "set_continuous";
|
||||
|
||||
public const string GetGrowthTime = "get_growth_time";
|
||||
public const string SetGrowthTime = "set_growth_time";
|
||||
|
||||
public const string GetDuration = "get_duration";
|
||||
public const string SetDuration = "set_duration";
|
||||
|
||||
public const string GetDecayTime = "get_decay_time";
|
||||
public const string SetDecayTime = "set_decay_time";
|
||||
|
||||
public const string GetNoiseEmitterLayer = "get_noise_emitter_layer";
|
||||
public const string SetNoiseEmitterLayer = "set_noise_emitter_layer";
|
||||
|
||||
public const string SetNoiseEmitterLayerValue = "set_noise_emitter_layer_value";
|
||||
|
||||
public const string Emit = "emit";
|
||||
public const string IsEmitting = "is_emitting";
|
||||
public const string Stop = "stop";
|
||||
public const string Toggle = "toggle";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://btom8l3wlkn2j
|
@@ -0,0 +1,83 @@
|
||||
using Godot;
|
||||
|
||||
namespace PhantomCamera.Noise;
|
||||
|
||||
public class PhantomCameraNoiseEmitter3D(GodotObject node)
|
||||
{
|
||||
public Node3D Node3D = (Node3D)node;
|
||||
|
||||
public PhantomCameraNoise3D Noise
|
||||
{
|
||||
get => new((Resource)Node3D.Call(MethodName.GetNoise));
|
||||
set => Node3D.Call(MethodName.SetNoise, (GodotObject)value.Resource);
|
||||
}
|
||||
|
||||
public bool Continuous
|
||||
{
|
||||
get => (bool)Node3D.Call(MethodName.GetContinuous);
|
||||
set => Node3D.Call(MethodName.SetContinuous, value);
|
||||
}
|
||||
|
||||
public float GrowthTime
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetGrowthTime);
|
||||
set => Node3D.Call(MethodName.SetGrowthTime, value);
|
||||
}
|
||||
|
||||
public float Duration
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetDuration);
|
||||
set => Node3D.Call(MethodName.SetDuration, value);
|
||||
}
|
||||
|
||||
public float DecayTime
|
||||
{
|
||||
get => (float)Node3D.Call(MethodName.GetDecayTime);
|
||||
set => Node3D.Call(MethodName.SetDecayTime, value);
|
||||
}
|
||||
|
||||
public int NoiseEmitterLayer
|
||||
{
|
||||
get => (int)Node3D.Call(MethodName.GetNoiseEmitterLayer);
|
||||
set => Node3D.Call(MethodName.SetNoiseEmitterLayer, value);
|
||||
}
|
||||
|
||||
public void SetNoiseEmitterLayerValue(int layer, bool value) =>
|
||||
Node3D.Call(MethodName.SetNoiseEmitterLayerValue, layer, value);
|
||||
|
||||
public void Emit() => Node3D.Call(MethodName.Emit);
|
||||
|
||||
public bool IsEmitting() => (bool)Node3D.Call(MethodName.IsEmitting);
|
||||
|
||||
public void Stop() => Node3D.Call(MethodName.Stop);
|
||||
|
||||
public void Toggle() => Node3D.Call(MethodName.Toggle);
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetNoise = "get_noise";
|
||||
public const string SetNoise = "set_noise";
|
||||
|
||||
public const string GetContinuous = "get_continuous";
|
||||
public const string SetContinuous = "set_continuous";
|
||||
|
||||
public const string GetGrowthTime = "get_growth_time";
|
||||
public const string SetGrowthTime = "set_growth_time";
|
||||
|
||||
public const string GetDuration = "get_duration";
|
||||
public const string SetDuration = "set_duration";
|
||||
|
||||
public const string GetDecayTime = "get_decay_time";
|
||||
public const string SetDecayTime = "set_decay_time";
|
||||
|
||||
public const string GetNoiseEmitterLayer = "get_noise_emitter_layer";
|
||||
public const string SetNoiseEmitterLayer = "set_noise_emitter_layer";
|
||||
|
||||
public const string SetNoiseEmitterLayerValue = "set_noise_emitter_layer_value";
|
||||
|
||||
public const string Emit = "emit";
|
||||
public const string IsEmitting = "is_emitting";
|
||||
public const string Stop = "stop";
|
||||
public const string Toggle = "toggle";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://buvda14filkjx
|
@@ -0,0 +1,128 @@
|
||||
using Godot;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace PhantomCamera;
|
||||
|
||||
public enum InterpolationMode
|
||||
{
|
||||
Auto,
|
||||
Idle,
|
||||
Physics
|
||||
}
|
||||
|
||||
public static class PhantomCameraHostExtensions
|
||||
{
|
||||
public static PhantomCameraHost AsPhantomCameraHost(this Node node)
|
||||
{
|
||||
return new PhantomCameraHost(node);
|
||||
}
|
||||
}
|
||||
|
||||
public class PhantomCameraHost()
|
||||
{
|
||||
public Node Node { get; } = null!;
|
||||
|
||||
public PhantomCameraHost(Node node) : this()
|
||||
{
|
||||
Node = node;
|
||||
|
||||
_callablePCamBecameActive = Callable.From<Node>(pCam => PCamBecameActive?.Invoke(pCam));
|
||||
_callablePCamBecameInactive = Callable.From<Node>(pCam => PCamBecameInactive?.Invoke(pCam));
|
||||
|
||||
Node.Connect(SignalName.PCamBecameActive, _callablePCamBecameActive);
|
||||
Node.Connect(SignalName.PCamBecameInactive, _callablePCamBecameInactive);
|
||||
}
|
||||
|
||||
~PhantomCameraHost()
|
||||
{
|
||||
Node.Disconnect(SignalName.PCamBecameActive, _callablePCamBecameActive);
|
||||
Node.Disconnect(SignalName.PCamBecameInactive, _callablePCamBecameInactive);
|
||||
}
|
||||
|
||||
public delegate void PCamBecameActiveEventHandler(Node pCam);
|
||||
public delegate void PCamBecameInactiveEventHandler(Node pCam);
|
||||
|
||||
public event PCamBecameActiveEventHandler? PCamBecameActive;
|
||||
public event PCamBecameInactiveEventHandler? PCamBecameInactive;
|
||||
|
||||
|
||||
private readonly Callable _callablePCamBecameActive;
|
||||
private readonly Callable _callablePCamBecameInactive;
|
||||
// For when Godot becomes the minimum version
|
||||
// public InterpolationMode InterpolationMode
|
||||
// {
|
||||
// get => (InterpolationMode)(int)Node.Call(MethodName.GetInterpolationMode);
|
||||
// set => Node.Call(MethodName.SetInterpolationMode, (int)value);
|
||||
// }
|
||||
|
||||
public int HostLayers
|
||||
{
|
||||
get => (int)Node.Call(PhantomCamera.MethodName.GetHostLayers);
|
||||
set => Node.Call(PhantomCamera.MethodName.SetHostLayers, value);
|
||||
}
|
||||
|
||||
public void SetHostLayersValue(int layer, bool value) => Node.Call(MethodName.SetHostLayersValue, layer, value);
|
||||
|
||||
public Camera2D? Camera2D => (Camera2D?)Node.Get(PropertyName.Camera2D);
|
||||
|
||||
public Camera3D? Camera3D => (Camera3D?)Node.Get(PropertyName.Camera3D);
|
||||
|
||||
public InterpolationMode InterpolationMode
|
||||
{
|
||||
get => (InterpolationMode)(int)Node.Call(MethodName.GetInterpolationMode);
|
||||
set => Node.Call(MethodName.SetInterpolationMode, (int)value);
|
||||
}
|
||||
|
||||
public bool TriggerPhantomCameraTween => (bool)Node.Call(MethodName.GetTriggerPhantomCameraTween);
|
||||
|
||||
public ActivePhantomCameraQueryResult? GetActivePhantomCamera()
|
||||
{
|
||||
var result = Node.Call(MethodName.GetActivePhantomCamera);
|
||||
return result.VariantType == Variant.Type.Nil ? null : new ActivePhantomCameraQueryResult(result.AsGodotObject());
|
||||
}
|
||||
|
||||
public static class PropertyName
|
||||
{
|
||||
public const string Camera2D = "camera_2d";
|
||||
public const string Camera3D = "camera_3d";
|
||||
}
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetActivePhantomCamera = "get_active_pcam";
|
||||
public const string GetTriggerPhantomCameraTween = "get_trigger_pcam_tween";
|
||||
|
||||
public const string GetInterpolationMode = "get_interpolation_mode";
|
||||
public const string SetInterpolationMode = "set_interpolation_mode";
|
||||
|
||||
public const string SetHostLayersValue = "set_host_layers_value";
|
||||
}
|
||||
|
||||
public static class SignalName
|
||||
{
|
||||
public const string PCamBecameActive = "pcam_became_active";
|
||||
public const string PCamBecameInactive = "pcam_became_inactive";
|
||||
}
|
||||
}
|
||||
|
||||
public class ActivePhantomCameraQueryResult(GodotObject godotObject)
|
||||
{
|
||||
public bool Is2D => godotObject.IsClass("Node2D") || ((Node)godotObject).Name.ToString().Contains("PhantomCamera2D")
|
||||
|| ((Node)godotObject).Name.ToString().Contains("PCam2D")
|
||||
|| ((Node)godotObject).Name.ToString().Contains("2D");
|
||||
|
||||
public bool Is3D => godotObject.IsClass("Node3D") || ((Node)godotObject).Name.ToString().Contains("PhantomCamera3D")
|
||||
|| ((Node)godotObject).Name.ToString().Contains("PCam3D")
|
||||
|| ((Node)godotObject).Name.ToString().Contains("3D");
|
||||
|
||||
public PhantomCamera2D? AsPhantomCamera2D()
|
||||
{
|
||||
return Is2D ? new PhantomCamera2D(godotObject) : null;
|
||||
}
|
||||
|
||||
public PhantomCamera3D? AsPhantomCamera3D()
|
||||
{
|
||||
return Is3D ? new PhantomCamera3D(godotObject) : null;
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://cr8brwrls2nn3
|
117
addons/phantom_camera/scripts/resources/Camera3DResource.cs
Normal file
117
addons/phantom_camera/scripts/resources/Camera3DResource.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using Godot;
|
||||
|
||||
namespace PhantomCamera;
|
||||
|
||||
public enum KeepAspect
|
||||
{
|
||||
KeepWidth,
|
||||
KeepHeight
|
||||
}
|
||||
|
||||
public enum ProjectionType
|
||||
{
|
||||
Perspective,
|
||||
Orthogonal,
|
||||
Frustum
|
||||
}
|
||||
|
||||
public class Camera3DResource(Resource resource)
|
||||
{
|
||||
public readonly Resource Resource = resource;
|
||||
|
||||
public KeepAspect KeepAspect
|
||||
{
|
||||
get => (KeepAspect)(int)Resource.Call(MethodName.GetKeepAspect);
|
||||
set => Resource.Call(MethodName.SetKeepAspect, (int)value);
|
||||
}
|
||||
|
||||
public int CullMask
|
||||
{
|
||||
get => (int)Resource.Call(MethodName.GetCullMask);
|
||||
set => Resource.Call(MethodName.SetCullMask, value);
|
||||
}
|
||||
|
||||
public void SetCullMaskValue(int layer, bool value) => Resource.Call(MethodName.SetCullMaskValue, layer, value);
|
||||
|
||||
public float HOffset
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetHOffset);
|
||||
set => Resource.Call(MethodName.SetHOffset, value);
|
||||
}
|
||||
|
||||
public float VOffset
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetVOffset);
|
||||
set => Resource.Call(MethodName.SetVOffset, value);
|
||||
}
|
||||
|
||||
public ProjectionType Projection
|
||||
{
|
||||
get => (ProjectionType)(int)Resource.Call(MethodName.GetProjection);
|
||||
set => Resource.Call(MethodName.SetProjection, (int)value);
|
||||
}
|
||||
|
||||
public float Fov
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetFov);
|
||||
set => Resource.Call(MethodName.SetFov, Mathf.Clamp(value, 1, 179));
|
||||
}
|
||||
|
||||
public float Size
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetSize);
|
||||
set => Resource.Call(MethodName.SetSize, Mathf.Clamp(value, 0.001f, float.PositiveInfinity));
|
||||
}
|
||||
|
||||
public Vector2 FrustumOffset
|
||||
{
|
||||
get => (Vector2)Resource.Call(MethodName.GetFrustumOffset);
|
||||
set => Resource.Call(MethodName.SetFrustumOffset, value);
|
||||
}
|
||||
|
||||
public float Near
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetNear);
|
||||
set => Resource.Call(MethodName.SetNear, Mathf.Clamp(value, 0.001f, float.PositiveInfinity));
|
||||
}
|
||||
|
||||
public float Far
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetFar);
|
||||
set => Resource.Call(MethodName.SetFar, Mathf.Clamp(value, 0.01f, float.PositiveInfinity));
|
||||
}
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetKeepAspect = "get_keep_aspect";
|
||||
public const string SetKeepAspect = "set_keep_aspect";
|
||||
|
||||
public const string GetCullMask = "get_cull_mask";
|
||||
public const string SetCullMask = "set_cull_mask";
|
||||
public const string SetCullMaskValue = "set_cull_mask_value";
|
||||
|
||||
public const string GetHOffset = "get_h_offset";
|
||||
public const string SetHOffset = "set_h_offset";
|
||||
|
||||
public const string GetVOffset = "get_v_offset";
|
||||
public const string SetVOffset = "set_v_offset";
|
||||
|
||||
public const string GetProjection = "get_projection";
|
||||
public const string SetProjection = "set_projection";
|
||||
|
||||
public const string GetFov = "get_fov";
|
||||
public const string SetFov = "set_fov";
|
||||
|
||||
public const string GetSize = "get_size";
|
||||
public const string SetSize = "set_size";
|
||||
|
||||
public const string GetFrustumOffset = "get_frustum_offset";
|
||||
public const string SetFrustumOffset = "set_frustum_offset";
|
||||
|
||||
public const string GetNear = "get_near";
|
||||
public const string SetNear = "set_near";
|
||||
|
||||
public const string GetFar = "get_far";
|
||||
public const string SetFar = "set_far";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://jedyxlihuwbj
|
@@ -0,0 +1,92 @@
|
||||
using Godot;
|
||||
|
||||
namespace PhantomCamera.Noise;
|
||||
|
||||
public class PhantomCameraNoise2D(Resource resource)
|
||||
{
|
||||
public readonly Resource Resource = resource;
|
||||
|
||||
public float Amplitude
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetAmplitude);
|
||||
set => Resource.Call(MethodName.SetAmplitude, value);
|
||||
}
|
||||
|
||||
public float Frequency
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetFrequency);
|
||||
set => Resource.Call(MethodName.SetFrequency, value);
|
||||
}
|
||||
|
||||
public bool RandomizeNoiseSeed
|
||||
{
|
||||
get => (bool)Resource.Call(MethodName.GetRandomizeNoiseSeed);
|
||||
set => Resource.Call(MethodName.SetRandomizeNoiseSeed, value);
|
||||
}
|
||||
|
||||
public int NoiseSeed
|
||||
{
|
||||
get => (int)Resource.Call(MethodName.GetNoiseSeed);
|
||||
set => Resource.Call(MethodName.SetNoiseSeed, value);
|
||||
}
|
||||
|
||||
public bool RotationalNoise
|
||||
{
|
||||
get => (bool)Resource.Call(MethodName.GetRotationalNoise);
|
||||
set => Resource.Call(MethodName.SetRotationalNoise, value);
|
||||
}
|
||||
|
||||
public bool PositionalNoise
|
||||
{
|
||||
get => (bool)Resource.Call(MethodName.GetPositionalNoise);
|
||||
set => Resource.Call(MethodName.SetPositionalNoise, value);
|
||||
}
|
||||
|
||||
public float RotationalMultiplier
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetRotationalMultiplier);
|
||||
set => Resource.Call(MethodName.SetRotationalMultiplier, value);
|
||||
}
|
||||
|
||||
public float PositionalMultiplierX
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetPositionalMultiplierX);
|
||||
set => Resource.Call(MethodName.SetPositionalMultiplierX, value);
|
||||
}
|
||||
|
||||
public float PositionalMultiplierY
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetPositionalMultiplierY);
|
||||
set => Resource.Call(MethodName.SetPositionalMultiplierY, value);
|
||||
}
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetAmplitude = "get_amplitude";
|
||||
public const string SetAmplitude = "set_amplitude";
|
||||
|
||||
public const string GetFrequency = "get_frequency";
|
||||
public const string SetFrequency = "set_frequency";
|
||||
|
||||
public const string GetRandomizeNoiseSeed = "get_randomize_noise_seed";
|
||||
public const string SetRandomizeNoiseSeed = "set_randomize_noise_seed";
|
||||
|
||||
public const string GetNoiseSeed = "get_noise_seed";
|
||||
public const string SetNoiseSeed = "set_noise_seed";
|
||||
|
||||
public const string GetRotationalNoise = "get_rotational_noise";
|
||||
public const string SetRotationalNoise = "set_rotational_noise";
|
||||
|
||||
public const string GetPositionalNoise = "get_positional_noise";
|
||||
public const string SetPositionalNoise = "set_positional_noise";
|
||||
|
||||
public const string GetRotationalMultiplier = "get_rotational_multiplier";
|
||||
public const string SetRotationalMultiplier = "set_rotational_multiplier";
|
||||
|
||||
public const string GetPositionalMultiplierX = "get_positional_multiplier_x";
|
||||
public const string SetPositionalMultiplierX = "set_positional_multiplier_x";
|
||||
|
||||
public const string GetPositionalMultiplierY = "get_positional_multiplier_y";
|
||||
public const string SetPositionalMultiplierY = "set_positional_multiplier_y";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://capjdoxs6gs6r
|
119
addons/phantom_camera/scripts/resources/PhantomCameraNoise3D.cs
Normal file
119
addons/phantom_camera/scripts/resources/PhantomCameraNoise3D.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using Godot;
|
||||
|
||||
namespace PhantomCamera.Noise;
|
||||
|
||||
public class PhantomCameraNoise3D(Resource resource)
|
||||
{
|
||||
public readonly Resource Resource = resource;
|
||||
|
||||
public float Amplitude
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetAmplitude);
|
||||
set => Resource.Call(MethodName.SetAmplitude, value);
|
||||
}
|
||||
|
||||
public float Frequency
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetFrequency);
|
||||
set => Resource.Call(MethodName.SetFrequency, value);
|
||||
}
|
||||
|
||||
public bool RandomizeNoiseSeed
|
||||
{
|
||||
get => (bool)Resource.Call(MethodName.GetRandomizeNoiseSeed);
|
||||
set => Resource.Call(MethodName.SetRandomizeNoiseSeed, value);
|
||||
}
|
||||
|
||||
public int NoiseSeed
|
||||
{
|
||||
get => (int)Resource.Call(MethodName.GetNoiseSeed);
|
||||
set => Resource.Call(MethodName.SetNoiseSeed, value);
|
||||
}
|
||||
|
||||
public bool RotationalNoise
|
||||
{
|
||||
get => (bool)Resource.Call(MethodName.GetRotationalNoise);
|
||||
set => Resource.Call(MethodName.SetRotationalNoise, value);
|
||||
}
|
||||
|
||||
public bool PositionalNoise
|
||||
{
|
||||
get => (bool)Resource.Call(MethodName.GetPositionalNoise);
|
||||
set => Resource.Call(MethodName.SetPositionalNoise, value);
|
||||
}
|
||||
|
||||
public float RotationalMultiplierX
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetRotationalMultiplierX);
|
||||
set => Resource.Call(MethodName.SetRotationalMultiplierX, value);
|
||||
}
|
||||
|
||||
public float RotationalMultiplierY
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetRotationalMultiplierY);
|
||||
set => Resource.Call(MethodName.SetRotationalMultiplierY, value);
|
||||
}
|
||||
|
||||
public float RotationalMultiplierZ
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetRotationalMultiplierZ);
|
||||
set => Resource.Call(MethodName.SetRotationalMultiplierZ, value);
|
||||
}
|
||||
|
||||
public float PositionalMultiplierX
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetPositionalMultiplierX);
|
||||
set => Resource.Call(MethodName.SetPositionalMultiplierX, value);
|
||||
}
|
||||
|
||||
public float PositionalMultiplierY
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetPositionalMultiplierY);
|
||||
set => Resource.Call(MethodName.SetPositionalMultiplierY, value);
|
||||
}
|
||||
|
||||
public float PositionalMultiplierZ
|
||||
{
|
||||
get => (float)Resource.Call(MethodName.GetPositionalMultiplierZ);
|
||||
set => Resource.Call(MethodName.SetPositionalMultiplierZ, value);
|
||||
}
|
||||
|
||||
public static class MethodName
|
||||
{
|
||||
public const string GetAmplitude = "get_amplitude";
|
||||
public const string SetAmplitude = "set_amplitude";
|
||||
|
||||
public const string GetFrequency = "get_frequency";
|
||||
public const string SetFrequency = "set_frequency";
|
||||
|
||||
public const string GetRandomizeNoiseSeed = "get_randomize_noise_seed";
|
||||
public const string SetRandomizeNoiseSeed = "set_randomize_noise_seed";
|
||||
|
||||
public const string GetNoiseSeed = "get_noise_seed";
|
||||
public const string SetNoiseSeed = "set_noise_seed";
|
||||
|
||||
public const string GetRotationalNoise = "get_rotational_noise";
|
||||
public const string SetRotationalNoise = "set_rotational_noise";
|
||||
|
||||
public const string GetPositionalNoise = "get_positional_noise";
|
||||
public const string SetPositionalNoise = "set_positional_noise";
|
||||
|
||||
public const string GetRotationalMultiplierX = "get_rotational_multiplier_x";
|
||||
public const string SetRotationalMultiplierX = "set_rotational_multiplier_x";
|
||||
|
||||
public const string GetRotationalMultiplierY = "get_rotational_multiplier_y";
|
||||
public const string SetRotationalMultiplierY = "set_rotational_multiplier_y";
|
||||
|
||||
public const string GetRotationalMultiplierZ = "get_rotational_multiplier_z";
|
||||
public const string SetRotationalMultiplierZ = "set_rotational_multiplier_z";
|
||||
|
||||
public const string GetPositionalMultiplierX = "get_positional_multiplier_x";
|
||||
public const string SetPositionalMultiplierX = "set_positional_multiplier_x";
|
||||
|
||||
public const string GetPositionalMultiplierY = "get_positional_multiplier_y";
|
||||
public const string SetPositionalMultiplierY = "set_positional_multiplier_y";
|
||||
|
||||
public const string GetPositionalMultiplierZ = "get_positional_multiplier_z";
|
||||
public const string SetPositionalMultiplierZ = "set_positional_multiplier_z";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://chk7643ynhe4f
|
@@ -0,0 +1,64 @@
|
||||
using Godot;
|
||||
|
||||
namespace PhantomCamera;
|
||||
|
||||
public enum TransitionType
|
||||
{
|
||||
Linear,
|
||||
Sine,
|
||||
Quint,
|
||||
Quart,
|
||||
Quad,
|
||||
Expo,
|
||||
Elastic,
|
||||
Cubic,
|
||||
Circ,
|
||||
Bounce,
|
||||
Back
|
||||
}
|
||||
|
||||
public enum EaseType
|
||||
{
|
||||
EaseIn,
|
||||
EaseOut,
|
||||
EaseInOut,
|
||||
EaseOutIn
|
||||
}
|
||||
|
||||
public static class PhantomCameraTweenExtensions
|
||||
{
|
||||
public static PhantomCameraTween AsPhantomCameraTween(this Resource resource)
|
||||
{
|
||||
return new PhantomCameraTween(resource);
|
||||
}
|
||||
}
|
||||
|
||||
public class PhantomCameraTween(Resource tweenResource)
|
||||
{
|
||||
public Resource Resource { get; } = tweenResource;
|
||||
|
||||
public float Duration
|
||||
{
|
||||
get => (float)Resource.Get(PropertyName.Duration);
|
||||
set => Resource.Set(PropertyName.Duration, value);
|
||||
}
|
||||
|
||||
public TransitionType Transition
|
||||
{
|
||||
get => (TransitionType)(int)Resource.Get(PropertyName.Transition);
|
||||
set => Resource.Set(PropertyName.Transition, (int)value);
|
||||
}
|
||||
|
||||
public EaseType Ease
|
||||
{
|
||||
get => (EaseType)(int)Resource.Get(PropertyName.Ease);
|
||||
set => Resource.Set(PropertyName.Ease, (int)value);
|
||||
}
|
||||
|
||||
public static class PropertyName
|
||||
{
|
||||
public const string Duration = "duration";
|
||||
public const string Transition = "transition";
|
||||
public const string Ease = "ease";
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
uid://ybr5c2s0tfvx
|
Reference in New Issue
Block a user