Gameplay Ingredients是一组用于 Unity 游戏的运行时和编辑器工具:一组脚本的集合,可在制作游戏和原型时简化简单的任务。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

64 行
2.0 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Timeline;
using GameplayIngredients.Rigs;
namespace GameplayIngredients.Actions
{
[Callable("Sequencing", "Actions/ic-action-director.png")]
public class DirectorControlRigAction : ActionBase
{
[NonNullCheck]
public DirectorControlRig directorControlRig;
[Header("Play Mode")]
public bool SetPlayMode = true;
public DirectorControlRig.PlayMode PlayMode = DirectorControlRig.PlayMode.Play;
[Header("Wrap Mode")]
public bool SetWrapMode = false;
public DirectorControlRig.WrapMode WrapMode = DirectorControlRig.WrapMode.Loop;
[Header("Time")]
public bool SetTime = false;
public float Time = 0.0f;
public bool SetStopTime = false;
public float StopTime = 1.0f;
[Header("Timeline Asset")]
public bool SetTimeline = false;
public TimelineAsset TimelineAsset;
public override void Execute(GameObject instigator = null)
{
if (directorControlRig == null)
{
Debug.LogWarning("No DirectorControlRig set, ignoring Call", this.gameObject);
return;
}
if (SetTime)
directorControlRig.time = Time;
if (SetPlayMode)
directorControlRig.playMode = PlayMode;
if (SetWrapMode)
directorControlRig.wrapMode = WrapMode;
if (SetStopTime)
directorControlRig.stopTime = StopTime;
if (SetTimeline)
directorControlRig.timeline = TimelineAsset;
}
public override string GetDefaultName()
{
return $"Set DirectorControlRig:{(SetPlayMode? " "+PlayMode.ToString():"")}{(SetWrapMode ? " " + WrapMode.ToString() : "")}{(SetTime ? " Time: " + Time.ToString() : "")}{(SetStopTime ? " Stop Time: " + Time.ToString() : "")}{(SetTimeline ? " Timeline: " + TimelineAsset?.name : "")}";
}
}
}