mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
This reverts commit 57781dc0bc.
The rename, although in line with what we did in the engine, caused problems with RTD we need to fix (or push for a fix) first.
353 lines
15 KiB
ReStructuredText
353 lines
15 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_AnimationNodeOneShot:
|
||
|
||
AnimationNodeOneShot
|
||
====================
|
||
|
||
**繼承:** :ref:`AnimationNodeSync<class_AnimationNodeSync>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
在 :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>` 中播放一次動畫。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
說明
|
||
----
|
||
|
||
新增到 :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>` 的資源。這個動畫節點將執行子動畫並在完成後返回。可以自訂淡入和淡出的混合時間以及篩檢程式。
|
||
|
||
在設定請求並更改動畫播放後,一次性節點會在下一個處理影格中通過將其 ``request`` 值設定為 :ref:`ONE_SHOT_REQUEST_NONE<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE>` 來自動清除請求。
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
# 播放連接到 “shot” 埠的子動畫。
|
||
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
|
||
# 替代語法(與上述結果相同)。
|
||
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE
|
||
|
||
# 中止連接到 “shot” 埠的子動畫。
|
||
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
|
||
# 替代語法(與上述結果相同)。
|
||
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
|
||
|
||
# 使用淡出的方法中止連接到 “shot”埠的子動畫。
|
||
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT)
|
||
# 替代語法(與上述結果相同)。
|
||
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
|
||
|
||
# 獲取目前狀態(唯讀)。
|
||
animation_tree.get("parameters/OneShot/active"))
|
||
# 替代語法(與上述結果相同)。
|
||
animation_tree["parameters/OneShot/active"]
|
||
|
||
# 獲取目前內部狀態(唯讀)。
|
||
animation_tree.get("parameters/OneShot/internal_active")
|
||
# 替代語法(與上述結果相同)。
|
||
animation_tree["parameters/OneShot/internal_active"]
|
||
|
||
.. code-tab:: csharp
|
||
|
||
// 播放連接到 “shot” 埠的子動畫。
|
||
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
|
||
|
||
// 中止連接到 “shot” 埠的子動畫。
|
||
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
|
||
|
||
// 使用淡出的方法中止連接到 “shot”埠的子動畫。
|
||
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);
|
||
|
||
// 獲取目前狀態(唯讀)。
|
||
animationTree.Get("parameters/OneShot/active");
|
||
|
||
// 獲取目前內部狀態(唯讀)。
|
||
animationTree.Get("parameters/OneShot/internal_active");
|
||
|
||
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
教學
|
||
----
|
||
|
||
- :doc:`使用 AnimationTree <../tutorials/animation/animation_tree>`
|
||
|
||
- `第三人稱射擊(TPS)示範 <https://godotengine.org/asset-library/asset/2710>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
屬性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` | ``false`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`float<class_float>` | :ref:`autorestart_delay<class_AnimationNodeOneShot_property_autorestart_delay>` | ``1.0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`float<class_float>` | :ref:`autorestart_random_delay<class_AnimationNodeOneShot_property_autorestart_random_delay>` | ``0.0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`break_loop_at_end<class_AnimationNodeOneShot_property_break_loop_at_end>` | ``false`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`Curve<class_Curve>` | :ref:`fadein_curve<class_AnimationNodeOneShot_property_fadein_curve>` | |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`float<class_float>` | :ref:`fadein_time<class_AnimationNodeOneShot_property_fadein_time>` | ``0.0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`Curve<class_Curve>` | :ref:`fadeout_curve<class_AnimationNodeOneShot_property_fadeout_curve>` | |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`float<class_float>` | :ref:`fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>` | ``0.0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` | :ref:`mix_mode<class_AnimationNodeOneShot_property_mix_mode>` | ``0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
列舉
|
||
----
|
||
|
||
.. _enum_AnimationNodeOneShot_OneShotRequest:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **OneShotRequest**: :ref:`🔗<enum_AnimationNodeOneShot_OneShotRequest>`
|
||
|
||
.. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_NONE** = ``0``
|
||
|
||
請求的預設狀態,不執行任何操作。
|
||
|
||
.. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FIRE** = ``1``
|
||
|
||
播放連接到「shot」埠之動畫的請求。
|
||
|
||
.. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_ABORT** = ``2``
|
||
|
||
停止連接到「shot」埠之動畫的請求。
|
||
|
||
.. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FADE_OUT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FADE_OUT** = ``3``
|
||
|
||
淡出連接到「shot」埠之動畫的請求。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_AnimationNodeOneShot_MixMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **MixMode**: :ref:`🔗<enum_AnimationNodeOneShot_MixMode>`
|
||
|
||
.. _class_AnimationNodeOneShot_constant_MIX_MODE_BLEND:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_BLEND** = ``0``
|
||
|
||
混合兩個動畫。另請參見 :ref:`AnimationNodeBlend2<class_AnimationNodeBlend2>`\ 。
|
||
|
||
.. _class_AnimationNodeOneShot_constant_MIX_MODE_ADD:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_ADD** = ``1``
|
||
|
||
以加成方式混合兩個動畫。另請參見 :ref:`AnimationNodeAdd2<class_AnimationNodeAdd2>`\ 。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
屬性說明
|
||
--------
|
||
|
||
.. _class_AnimationNodeOneShot_property_autorestart:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **autorestart** = ``false`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_autorestart**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **has_autorestart**\ (\ )
|
||
|
||
如果為 ``true``\ ,子動畫結束後會自動重新開始。
|
||
|
||
換句話說,要開始自動重啟,必須使用 :ref:`ONE_SHOT_REQUEST_FIRE<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE>` 請求播放一次動畫。\ :ref:`ONE_SHOT_REQUEST_ABORT<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT>` 請求停止自動重啟,但它不會禁用 :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` 本身。因此,\ :ref:`ONE_SHOT_REQUEST_FIRE<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE>` 請求將再次開始自動重啟。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_autorestart_delay:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **autorestart_delay** = ``1.0`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart_delay>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_autorestart_delay**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_autorestart_delay**\ (\ )
|
||
|
||
觸發自動重啟的延遲時間,以秒為單位。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_autorestart_random_delay:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **autorestart_random_delay** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart_random_delay>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_autorestart_random_delay**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_autorestart_random_delay**\ (\ )
|
||
|
||
如果 :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` 為 ``true``\ ,則介於0和此值之間的隨機附加延遲(以秒為單位)將新增到 :ref:`autorestart_delay<class_AnimationNodeOneShot_property_autorestart_delay>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_break_loop_at_end:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **break_loop_at_end** = ``false`` :ref:`🔗<class_AnimationNodeOneShot_property_break_loop_at_end>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_break_loop_at_end**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_loop_broken_at_end**\ (\ )
|
||
|
||
如果為 ``true``\ ,即使動畫設定為循環,也會在本迴圈結束時中斷迴圈以進行轉場。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_fadein_curve:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Curve<class_Curve>` **fadein_curve** :ref:`🔗<class_AnimationNodeOneShot_property_fadein_curve>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_fadein_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
|
||
- :ref:`Curve<class_Curve>` **get_fadein_curve**\ (\ )
|
||
|
||
決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 :ref:`Curve<class_Curve>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_fadein_time:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **fadein_time** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_fadein_time>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_fadein_time**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_fadein_time**\ (\ )
|
||
|
||
淡入持續時間。例如,對長度 5 秒的動畫將此值設為 ``1.0``\ ,會產生從 0 秒開始至 1 秒結束的交叉淡入。
|
||
|
||
\ **注意:** **AnimationNodeOneShot** 會在淡入結束後才切換目前狀態。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_fadeout_curve:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Curve<class_Curve>` **fadeout_curve** :ref:`🔗<class_AnimationNodeOneShot_property_fadeout_curve>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_fadeout_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
|
||
- :ref:`Curve<class_Curve>` **get_fadeout_curve**\ (\ )
|
||
|
||
決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 :ref:`Curve<class_Curve>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_fadeout_time:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **fadeout_time** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_fadeout_time>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_fadeout_time**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_fadeout_time**\ (\ )
|
||
|
||
淡出持續時間。例如,對長度 5 秒的動畫將此值設為 ``1.0``\ ,會產生從 4 秒開始至 5 秒結束的交叉淡出。
|
||
|
||
\ **注意:** **AnimationNodeOneShot** 會在淡出結束後才切換目前狀態。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AnimationNodeOneShot_property_mix_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **mix_mode** = ``0`` :ref:`🔗<class_AnimationNodeOneShot_property_mix_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_mix_mode**\ (\ value\: :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>`\ )
|
||
- :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **get_mix_mode**\ (\ )
|
||
|
||
混合型別。
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
|
||
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
|
||
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
|
||
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
|
||
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
|
||
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
|
||
.. |void| replace:: :abbr:`void (無回傳值。)`
|