浏览代码

Added Option "Sacrifice Oldest" to Factory

/main
Thomas ICHÉ 5 年前
当前提交
10c231c8
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 10
      Runtime/Ingredients/Factory/Factory.cs

10
Runtime/Ingredients/Factory/Factory.cs


[NonNullCheck]
public GameObject SpawnTarget;
public SpawnLocation spawnLocation = SpawnLocation.SameSceneAsTarget;
[Tooltip("Sacrifices oldest instance if necessary")]
public bool SacrificeOldest = false;
[Header("Reap and Respawn")]
public bool RespawnTarget = true;

if (m_Instances == null)
m_Instances = new List<GameObject>();
if(m_Instances.Count == MaxInstances && SacrificeOldest)
{
var oldest = m_Instances[0];
m_Instances.RemoveAt(0);
Destroy(oldest);
}
if (m_Instances.Count < MaxInstances)
{

正在加载...
取消
保存