Contents
概要
すべてのクロスコンポーネントの取りまとめを行う重要なMonoBehaviourクラスです。
通常はエディタ環境でGameObjectに取り付けますが、すべてをスクリプトから構築することも可能です。
また、実行中にパラメータを操作して振る舞いを変えることも可能です。
スクリプトからの構築や操作は実行時スクリプトのページを参照してください。
Properties
serializeData
/// <summary>
/// Serialize data (1).
/// Basic parameters.
/// Import/export target.
/// Can be rewritten at runtime.
/// </summary>
[SerializeField]
private ClothSerializeData serializeData = new ClothSerializeData();
public ClothSerializeData SerializeData => serializeData;
実行時に操作可能なパラメータを保持します。
スクリプトからは主にこのクラスを操作します。
詳細はClothSerializeDataを参照してください。
OnBuildComplete
/// <summary>
/// クロスデータ構築完了後イベント
/// Event after completion of cloth data construction.
/// (true = Success, false = Failure)
/// </summary>
public Action<bool> OnBuildComplete;
Methods
IsValid
/// <summary>
/// Check if the cloth component is in a valid state.
/// クロスコンポーネントが有効な状態か確認します。
/// </summary>
/// <returns></returns>
public bool IsValid()
Initialize
/// <summary>
/// 初期化を実行します
/// すでに初期化済みの場合は何もしません。
/// perform initialization.
/// If already initialized, do nothing.
/// </summary>
public void Initialize()
DisableAutoBuild
/// <summary>
/// コンポーネントのStart()で実行される自動ビルドを無効にします
/// Disable automatic builds that run on the component's Start().
/// </summary>
public void DisableAutoBuild()
BuildAndRun
/// <summary>
/// コンポーネントを構築し実行します
/// すべてのデータをセットアップしたあとに呼び出す必要があります
/// build and run the component.
/// Must be called after setting up all data.
/// </summary>
/// <returns>true=start build. false=build failed.</returns>
public bool BuildAndRun()
ReplaceTransform
/// <summary>
/// コンポーネントが保持するトランスフォームを置換します。
/// 置換先のトランスフォーム名をキーとした辞書を渡します。
/// Replaces a component's transform.
/// Passes a dictionary keyed by the name of the transform to be replaced.
/// </summary>
/// <param name="targetTransformDict">Dictionary keyed by the name of the transform to be replaced.</param>
public void ReplaceTransform(Dictionary<string, Transform> targetTransformDict)
SetParameterChange
/// <summary>
/// パラメータの変更を通知
/// 実行中にパラメータを変更した場合はこの関数を呼ぶ必要があります
/// You should call this function if you changed parameters during execution.
/// </summary>
public void SetParameterChange()
SetTimeScale
/// <summary>
/// タイムスケールを変更します
/// Change the time scale.
/// </summary>
/// <param name="timeScale">0.0-1.0</param>
public void SetTimeScale(float timeScale)
GetTimeScale
/// <summary>
/// タイムスケールを取得します
/// Get the time scale.
/// </summary>
/// <returns></returns>
public float GetTimeScale()
ResetCloth
/// <summary>
/// シミュレーションを初期状態にリセットします
/// Reset the simulation to its initial state.
/// </summary>
public void ResetCloth()
end.