浏览代码

Base work for Making Update Calls Optional

/main
Thomas ICHÉ 5 年前
当前提交
f910e534
共有 3 个文件被更改,包括 19 次插入5 次删除
  1. 7
      Runtime/Ingredients/StateMachine/State.cs
  2. 9
      Runtime/Ingredients/StateMachine/StateMachine.cs
  3. 8
      Runtime/Settings/GameplayIngredientsSettings.cs

7
Runtime/Ingredients/StateMachine/State.cs


public Callable[] OnStateEnter;
[ReorderableList]
public Callable[] OnStateExit;
[ReorderableList]
[ReorderableList, ShowIf("AllowUpdateCalls")]
private bool AllowUpdateCalls()
{
return GameplayIngredientsSettings.currentSettings.allowUpdateCalls;
}
}
}

9
Runtime/Ingredients/StateMachine/StateMachine.cs


Debug.LogWarning(string.Format("{0} : Trying to set unknown state {1}", gameObject.name, stateName), gameObject);
}
public void Update()
void Update()
if (m_CurrentState != null)
if (GameplayIngredientsSettings.currentSettings.allowUpdateCalls
&& m_CurrentState != null
&& m_CurrentState.OnStateUpdate != null
&& m_CurrentState.OnStateUpdate.Length > 0)
{
}
}
}

8
Runtime/Settings/GameplayIngredientsSettings.cs


{
public string[] excludedeManagers { get { return m_ExcludedManagers; } }
public bool verboseCalls { get { return m_VerboseCalls; } }
public bool allowUpdateCalls { get { return m_AllowUpdateCalls; } }
public bool disableWelcomeScreenAutoStart { get { return m_DisableWelcomeScreenAutoStart; } }
[BoxGroup("Editor")]

protected string[] m_ExcludedManagers;
[BoxGroup("Callables")]
[SerializeField, InfoBox("Verbose Calls enable logging at runtime, this can lead to performance drop, use only when debugging.",InfoBoxType.Warning, "m_VerboseCalls")]
protected bool m_VerboseCalls;
[SerializeField, InfoBox("Verbose Calls enable logging at runtime, this can lead to performance drop, use only when debugging.", InfoBoxType.Warning, "m_VerboseCalls")]
private bool m_VerboseCalls = false;
[SerializeField, InfoBox("Per-update calls should be avoided. Enable if strictly necessary.", InfoBoxType.Warning, "m_AllowUpdateCalls")]
private bool m_AllowUpdateCalls = false;
const string kAssetName = "GameplayIngredientsSettings";

正在加载...
取消
保存