VisibleOnScreenEnabler2D

继承: VisibleOnScreenNotifier2D < Node2D < CanvasItem < Node < Object

A rectangular region of 2D space that, when visible on screen, enables a target node.

描述

VisibleOnScreenEnabler2D contains a rectangular region of 2D space and a target node. The target node will be automatically enabled (via its Node.process_mode property) when any part of this region becomes visible on the screen, and automatically disabled otherwise. This can for example be used to activate enemies only when the player approaches them.

See VisibleOnScreenNotifier2D if you only want to be notified when the region is visible on screen.

Note: VisibleOnScreenEnabler2D uses the render culling code to determine whether it's visible on screen, so it won't function unless CanvasItem.visible is set to true.

属性


枚举

enum EnableMode:

EnableMode ENABLE_MODE_INHERIT = 0

Corresponds to Node.PROCESS_MODE_INHERIT.

EnableMode ENABLE_MODE_ALWAYS = 1

Corresponds to Node.PROCESS_MODE_ALWAYS.

EnableMode ENABLE_MODE_WHEN_PAUSED = 2

Corresponds to Node.PROCESS_MODE_WHEN_PAUSED.


属性说明

EnableMode enable_mode = 0

Determines how the target node is enabled. Corresponds to ProcessMode. When the node is disabled, it always uses Node.PROCESS_MODE_DISABLED.


NodePath enable_node_path = NodePath("..")

  • void set_enable_node_path ( value: NodePath )
  • NodePath get_enable_node_path ( )

The path to the target node, relative to the VisibleOnScreenEnabler2D. The target node is cached; it's only assigned when setting this property (if the VisibleOnScreenEnabler2D is inside the scene tree) and every time the VisibleOnScreenEnabler2D enters the scene tree. If the path is empty, no node will be affected. If the path is invalid, an error is also generated.

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。