Esempio n. 1
0
        public static T Populate <T>(this object o, int poolID, int prefabID, Vector3 startPosition = default(Vector3),
                                     Quaternion startRotation = default(Quaternion), Transform parent = null,
                                     WorldParenters parenters = WorldParenters.Level) where T : class
        {
            var tr = o.Populate(poolID, prefabID, startPosition, startRotation, parent, parenters);

            return(tr.GetComponentInChildren <T>());
        }
        public static Transform Populate(this object o, Pool poolID, GameObject prefab,
                                         Vector3 startPosition    = default(Vector3), Quaternion startRotation = default(Quaternion), Transform parent = null,
                                         WorldParenters parenters = WorldParenters.Level)
        {
            var parenter = parent ?? Toolbox.Get <ProcessingScene>().Get(parenters);

            var go = poolID == Pool.None
                                ? Object.Instantiate(prefab, startPosition, startRotation, parenter).transform
                                : ProcessingGoPool.HandleSpawn(poolID, prefab, startPosition, startRotation, parenter).transform;

            go.position = startPosition;
            return(go);
        }
        public static Transform Populate(this object o, Pool poolID, string prefabID,
                                         Vector3 startPosition    = default(Vector3), Quaternion startRotation = default(Quaternion), Transform parent = null,
                                         WorldParenters parenters = WorldParenters.Level)
        {
            var parenter = parent ?? ProcessingScene.Default.Get(parenters);
            var prefab   = ProcessingResources.GetPrefab <GameObject>(prefabID);

            var go = poolID == Pool.None
                                ? Object.Instantiate(prefab, startPosition, startRotation, parenter).transform
                                : ProcessingGoPool.HandleSpawn(poolID, prefab, startPosition, startRotation, parenter).transform;

            go.localPosition = startPosition;
            go.position      = startPosition;
            return(go);
        }
        public Transform Get(WorldParenters parent)
        {
            switch (parent)
            {
            case WorldParenters.Level:
                return(Get("Dynamic"));

            case WorldParenters.UI:
                return(Get("[UI]"));

            case WorldParenters.None:
                return(Get("[SCENE]"));
            }

            return(null);
        }
Esempio n. 5
0
        public static Transform Populate(this object o, int poolID, GameObject prefab,
                                         Vector3 startPosition    = default(Vector3), Quaternion startRotation = default(Quaternion),
                                         Transform parent         = null,
                                         WorldParenters parenters = WorldParenters.Level)
        {
            var parenter = parent ?? ProcessingScene.Default.Get(parenters);


            var go = poolID == Pool.None
                ? Object.Instantiate(prefab, parenter).transform
                : ProcessingPool.pools[poolID].Spawn(prefab, parenter).transform;

            go.localPosition = startPosition;
            go.localRotation = startRotation;
            return(go);
        }