private void Awake() { throwableObjectPool = new ObjectPool <ThrowableObject>( () => { GameObject gameObject = Finder.PrefabFactory.CreateThrowableObject(transform); gameObject.SetActive(false); ThrowableObject throwableObject = gameObject.GetComponent <ThrowableObject>(); throwableObject.Thrower = this; return(throwableObject); }, throwableObjectPoolSize ); waitForThrowNewObjectDelay = new FreezableWaitForSeconds(throwNextObjectDelay); }
public void RemoveThrownObject(ThrowableObject thrownObject) { thrownObject.gameObject.SetActive(false); throwableObjectPool.PutObject(thrownObject); }