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

69 行
2.0 KiB

using ICSharpCode.NRefactory.Ast;
using NaughtyAttributes;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameplayIngredients.Rigs
{
public abstract class Rig : MonoBehaviour
{
public UpdateMode updateMode
{
get { return m_UpdateMode; }
}
public int rigPriority
{
get { return m_RigPriority; }
}
public enum UpdateMode
{
Update,
LateUpdate,
FixedUpdate,
}
public abstract UpdateMode defaultUpdateMode { get; }
public abstract int defaultPriority { get; }
public virtual bool canChangeUpdateMode { get { return false; } }
protected bool CanChangeUpdateMode() { return canChangeUpdateMode; }
[SerializeField, EnableIf("CanChangeUpdateMode")]
private UpdateMode m_UpdateMode;
[SerializeField]
private int m_RigPriority = 0;
private void Reset()
{
if(!canChangeUpdateMode)
m_UpdateMode = defaultUpdateMode;
m_RigPriority = defaultPriority;
}
protected virtual void OnEnable()
{
if (Manager.TryGet(out RigManager rigManager))
rigManager.RegistedRig(this);
else
Debug.LogWarning($"{gameObject.name} : Could not register the Rig of type {GetType().Name}. Rig Manager is not present or has been excluded. Please check your Assets/GameplayIngredientsSettings asset");
}
protected virtual void OnDisable()
{
if (Manager.TryGet(out RigManager rigManager))
rigManager.RemoveRig(this);
else
Debug.LogWarning($"{gameObject.name} : Could not remove the Rig of type {GetType().Name}. Rig Manager is not present or has been excluded. Please check your Assets/GameplayIngredientsSettings asset");
}
public abstract void UpdateRig(float deltaTime);
}
}