rj-action-library/Runtime/Godot/NodeState.cs

47 lines
1.1 KiB
C#
Raw Normal View History

2024-08-04 09:08:12 +00:00
using Godot;
using System.Collections.Generic;
using System;
namespace Rokojori
{
public class NodeState
{
public static void Configure( Node n, bool processEnabled, bool inputEnabled, bool physicsEnabled, bool signalsEnabled,
Node.ProcessModeEnum processMode )
{
n.SetProcess( processEnabled );
n.SetProcessInput( inputEnabled );
n.SetPhysicsProcess( physicsEnabled );
n.SetBlockSignals( ! signalsEnabled );
n.ProcessMode = processMode;
}
public static void Set( Node n, bool enabled )
{
Configure( n, enabled, enabled, enabled, enabled, enabled ? Node.ProcessModeEnum.Inherit : Node.ProcessModeEnum.Disabled );
}
public static void Set( Node[] nodes, bool enabled )
{
Arrays.ForEach( nodes, n => Set( n, enabled ) );
}
public static void Enable( Node n )
{
Set( n, true );
}
public static void Enable( Node[] n )
{
Set( n, true );
}
public static void Disable( Node n )
{
Set( n, true );
}
}
}