Files
godot-docs-l10n/classes/zh_CN/class_animationnodestatemachineplayback.rst

232 lines
10 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/AnimationNodeStateMachinePlayback.xml.
.. _class_AnimationNodeStateMachinePlayback:
AnimationNodeStateMachinePlayback
=================================
**继承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
:ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` 提供播放控制。
.. rst-class:: classref-introduction-group
描述
----
允许控制使用 :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` 创建的 :ref:`AnimationTree<class_AnimationTree>` 状态机。使用 ``$AnimationTree.get("parameters/playback")`` 检索。
\ **示例:**\
.. tabs::
.. code-tab:: gdscript
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
.. code-tab:: csharp
var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback").As<AnimationNodeStateMachinePlayback>();
stateMachine.Travel("some_state");
.. rst-class:: classref-introduction-group
教程
----
- :doc:`使用 AnimationTree <../tutorials/animation/animation_tree>`
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+-------------------------+-------------------------+---------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | resource_local_to_scene | ``true`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
+-------------------------+-------------------------+---------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_current_length<class_AnimationNodeStateMachinePlayback_method_get_current_length>` **(** **)** |const| |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_current_node<class_AnimationNodeStateMachinePlayback_method_get_current_node>` **(** **)** |const| |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_current_play_position<class_AnimationNodeStateMachinePlayback_method_get_current_play_position>` **(** **)** |const| |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_fading_from_node<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>` **(** **)** |const| |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName[]<class_StringName>` | :ref:`get_travel_path<class_AnimationNodeStateMachinePlayback_method_get_travel_path>` **(** **)** |const| |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationNodeStateMachinePlayback_method_is_playing>` **(** **)** |const| |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`next<class_AnimationNodeStateMachinePlayback_method_next>` **(** **)** |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`start<class_AnimationNodeStateMachinePlayback_method_start>` **(** :ref:`StringName<class_StringName>` node, :ref:`bool<class_bool>` reset=true **)** |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`stop<class_AnimationNodeStateMachinePlayback_method_stop>` **(** **)** |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`travel<class_AnimationNodeStateMachinePlayback_method_travel>` **(** :ref:`StringName<class_StringName>` to_node, :ref:`bool<class_bool>` reset_on_teleport=true **)** |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_AnimationNodeStateMachinePlayback_method_get_current_length:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_current_length** **(** **)** |const|
返回当前状态长度。
\ **注意:**\ 有可能任何 :ref:`AnimationRootNode<class_AnimationRootNode>` 既可以是节点也可以是动画。这意味着在单个状态中可以有多个动画。哪个动画长度会优先,取决于其内部连接的节点。此外,如果过渡未重置,则将返回该点的剩余长度。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_get_current_node:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **get_current_node** **(** **)** |const|
返回当前的动画播放状态。
\ **注意:**\ 使用交叉叠化时,当前状态会在交叉叠化开始后理解变为下一个状态。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_get_current_play_position:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_current_play_position** **(** **)** |const|
返回当前动画状态内的播放位置。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_get_fading_from_node:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **get_fading_from_node** **(** **)** |const|
返回当前淡入淡出动画的开始状态。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_get_travel_path:
.. rst-class:: classref-method
:ref:`StringName[]<class_StringName>` **get_travel_path** **(** **)** |const|
返回 A\* 算法内部计算的当前行进路径。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_is_playing:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_playing** **(** **)** |const|
如果正在播放动画,返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_next:
.. rst-class:: classref-method
void **next** **(** **)**
如果通过行进或自动前进有下一条路径,则立即从当前状态过渡到下一个状态。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_start:
.. rst-class:: classref-method
void **start** **(** :ref:`StringName<class_StringName>` node, :ref:`bool<class_bool>` reset=true **)**
开始播放给定的动画。
如果 ``reset````true``\ ,则动画从头开始播放。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_stop:
.. rst-class:: classref-method
void **stop** **(** **)**
停止当前播放的动画。
.. rst-class:: classref-item-separator
----
.. _class_AnimationNodeStateMachinePlayback_method_travel:
.. rst-class:: classref-method
void **travel** **(** :ref:`StringName<class_StringName>` to_node, :ref:`bool<class_bool>` reset_on_teleport=true **)**
按照最短的路径从当前状态过渡到另一个状态。
如果路径没有连接到当前状态,则动画将在状态传送后播放。
如果 ``reset_on_teleport````true``\ ,当行进导致传送时,该动画将从头开始播放。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法没有副作用。不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,所以可以直接使用类名调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效操作符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列标志构成的位掩码整数。)`