示例#1
0
        // ================================================================================
        //  private methods
        // --------------------------------------------------------------------------------

        private IPooledObject CreateNewObject(Vector3?pos = null)
        {
            GameObject    newObject = GameObjectFactory.GameObject(_prefab, position: pos);
            IPooledObject instance  = newObject.transform.GetInterface <IPooledObject>();

            if (instance == null)
            {
                Debug.LogError("Object " + _prefab + " has no Type " + typeof(IPooledObject));
            }

            return(instance);
        }
示例#2
0
        // ================================================================================
        //  private methods
        // --------------------------------------------------------------------------------

        private IPooledObject CreateNewObject(Vector3?pos = null)
        {
            MonoBehaviour newObject = GameObjectFactory.Instantiate(_prefab, position: pos);

            if (_parent != null)
            {
                newObject.transform.SetParent(_parent);
            }

            IPooledObject instance = newObject as IPooledObject;

            if (instance == null)
            {
                Debug.LogError("Object " + _prefab + " is not of type " + typeof(IPooledObject));
            }

            return(instance);
        }