47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
|
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 );
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|