Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Docs/VS_Scratch_Mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Scratch ブロックと FUnity 独自 Visual Scripting Unit の対応関係で
| ○と言う | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.SayUnit | ○と言う | FUnity/Scratch/見た目 | 無期限の発言吹き出し。定義: Runtime/.../SpeechUnits.cs |
| ○と○秒考える | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.ThinkForSecondsUnit | ○と○秒考える | FUnity/Scratch/見た目 | 指定秒数で思考吹き出し。定義: Runtime/.../SpeechUnits.cs |
| ○と考える | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.ThinkUnit | ○と考える | FUnity/Scratch/見た目 | 無期限の思考吹き出し。定義: Runtime/.../SpeechUnits.cs |
| 色の効果を○ずつ変える | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.ChangeColorEffectByUnit | 色の効果を○ずつ変える | FUnity/Scratch/見た目 | 色効果を相対変更。定義: Runtime/.../EffectUnits.cs |
| 色の効果を○ずつ変える | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.ChangeColorEffectByUnit | 色の効果を○ずつ変える | FUnity/Scratch/見た目 | 色効果を相対変更。Actor はコンテキストから自動解決。定義: Runtime/.../EffectUnits.cs |
| 色の効果を○にする | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.SetColorEffectToUnit | 色の効果を○にする | FUnity/Scratch/見た目 | 色効果を絶対設定。定義: Runtime/.../EffectUnits.cs |
| 画像効果をなくす | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.ClearGraphicEffectsUnit | 画像効果をなくす | FUnity/Scratch/見た目 | Tint をリセット。定義: Runtime/.../EffectUnits.cs |
| 表示する | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.ShowActorUnit | 表示する | FUnity/Scratch/見た目 | 俳優を表示状態へ。定義: Runtime/.../VisibilityUnits.cs |
Expand All @@ -54,14 +54,14 @@ Scratch ブロックと FUnity 独自 Visual Scripting Unit の対応関係で
| ○秒待つ | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WaitSecondsUnit | ○秒待つ | FUnity/Scratch/制御 | 指定時間待機。定義: Runtime/.../WaitSecondsUnit.cs |
| 自分のクローンを作る | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.CreateCloneOfSelfUnit | 自分のクローンを作る | FUnity/Scratch/制御 | 自身を複製。定義: Runtime/.../CloneUnits.cs |
| ○のクローンを作る | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.CreateCloneOfDisplayNameUnit | ○のクローンを作る | FUnity/Scratch/制御 | 指定俳優を複製。定義: Runtime/.../CloneUnits.cs |
| クローンされたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenIStartAsCloneUnit | クローンされたとき | FUnity/Scratch/制御 | クローン生成時イベント。定義: Runtime/.../CloneUnits.cs |
| このクローンを削除する | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.DeleteThisCloneUnit | このクローンを削除する | FUnity/Scratch/制御 | クローンを破棄。定義: Runtime/.../CloneUnits.cs |
| もし○なら | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.IfThenUnit | もし○なら | FUnity/Scratch/制御 | 条件成立時のみ本体を実行。定義: Runtime/.../ConditionUnits.cs |

## イベント
| Scratch ブロック (日本語) | FUnity Unit クラス | UnitTitle | UnitCategory | 備考 |
| --- | --- | --- | --- | --- |
| 緑の旗が押されたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenGreenFlagClickedUnit | 緑の旗が押されたとき | FUnity/Scratch/イベント | Runner 対象の緑の旗イベント。定義: Runtime/.../GreenFlagUnits.cs |
| クローンされたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.WhenIStartAsCloneUnit | クローンされたとき | FUnity/Scratch/イベント | クローン生成時イベント。定義: Runtime/.../CloneUnits.cs |
| ○キーが押されたとき | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.OnKeyPressedUnit | ○キーが押されたとき | FUnity/Scratch/イベント | 押下エッジで発火。定義: Runtime/.../InputEventUnits.cs |
| メッセージを送る | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.BroadcastMessageUnit | メッセージを送る | FUnity/Scratch/イベント | 即時配信。定義: Runtime/.../MessagingUnits.cs |
| メッセージを送って待つ | FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits.BroadcastAndWaitUnit | メッセージを送って待つ | FUnity/Scratch/イベント | 同期配信後に継続。定義: Runtime/.../MessagingUnits.cs |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ private IEnumerator Run(Flow flow)
}

/// <summary>
/// Scratch の「クローンされたとき」イベントを表現し、新しく生成されたクローンごとにトリガーを発火します
/// Scratch の「イベント/クローンされたとき」を表現し、新規クローン生成時にトリガーを発火します
/// </summary>
[UnitTitle("クローンされたとき")]
[UnitCategory("FUnity/Scratch/制御")]
[UnitSubtitle("funity scratch 制御 clone event when クローン")]
[UnitShortTitle("クローンされたとき")]
[UnitCategory("FUnity/Scratch/イベント")]
[UnitSubtitle("funity scratch イベント clone クローン 生成 された when")]
[TypeIcon(typeof(FUnityScratchUnitIcon))]
public sealed class WhenIStartAsCloneUnit : EventUnit<CloneEventArgs>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace FUnity.Runtime.Integrations.VisualScripting.Units.ScratchUnits
{
/// <summary>
/// Scratch の「色の効果を ◯ ずつ変える」に対応し、Presenter 経由で色相回転を相対適用するカスタム Unit です。
/// 対象の <see cref="ActorPresenterAdapter"/> は <see cref="ScratchUnitUtil.ResolveAdapter(Flow)"/> により自動解決します。
/// </summary>
[UnitTitle("色の効果を○ずつ変える")]
[UnitCategory("FUnity/Scratch/見た目")]
Expand All @@ -31,10 +32,6 @@ public sealed class ChangeColorEffectByUnit : Unit
[DoNotSerialize]
private ValueInput m_Delta;

/// <summary>対象俳優を識別する DisplayName または Self を受け取るポートです。</summary>
[DoNotSerialize]
private ValueInput m_ActorKey;

/// <summary>enter ポートへの参照を公開します。</summary>
public ControlInput Enter => m_Enter;

Expand All @@ -44,18 +41,14 @@ public sealed class ChangeColorEffectByUnit : Unit
/// <summary>delta ポートへの参照を公開します。</summary>
public ValueInput Delta => m_Delta;

/// <summary>actor ポートへの参照を公開します。</summary>
public ValueInput Actor => m_ActorKey;

/// <summary>
/// ポートを定義し、enter→exit の制御線と delta/actor の値入力を登録します。
/// ポートを定義し、enter→exit の制御線と delta の値入力を登録します。
/// </summary>
protected override void Definition()
{
m_Enter = ControlInputCoroutine("enter", Run);
m_Exit = ControlOutput("exit");
m_Delta = ValueInput<float>("delta", 10f);
m_ActorKey = ValueInput<string>("actor", "Self");

Succession(m_Enter, m_Exit);
}
Expand All @@ -68,15 +61,10 @@ protected override void Definition()
private IEnumerator Run(Flow flow)
{
var delta = flow.GetValue<float>(m_Delta);
var actorKey = flow.GetValue<string>(m_ActorKey);
var adapter = GraphicEffectUnitUtil.ResolveAdapter(flow, actorKey, UnitName, out var usedSelf);
var adapter = ScratchUnitUtil.ResolveAdapter(flow);
if (adapter == null)
{
if (usedSelf)
{
Debug.LogWarning("[FUnity] Scratch/Change Color Effect by: ActorPresenterAdapter が未解決のため色の効果を変更できません。VSPresenterBridge などでアダプタを登録してください。");
}

Debug.LogWarning("[FUnity] Scratch/Change Color Effect by: ActorPresenterAdapter が未解決のため色の効果を変更できません。VSPresenterBridge などでアダプタを登録してください。");
yield return m_Exit;
yield break;
}
Expand Down