public PoolUnit UnitDefiner(PoolUnit p) { SpriteRenderer mSpr = p.GetComponent <SpriteRenderer>(); if (!spr) { spr = GetComponent <SpriteRenderer>(); } spr.drawMode = mSpr.drawMode; transform.localScale = p.transform.localScale; transform.rotation = Quaternion.Euler(0, 0, 0); spr.sortingOrder = mSpr.sortingOrder; if (!boxC) { boxC = GetComponent <BoxCollider2D>(); } BoxCollider2D mBoxC = p.GetComponent <BoxCollider2D>(); boxC.size = mBoxC.size; boxC.offset = mBoxC.offset; spr.size = mSpr.size; spr.sprite = mSpr.sprite; spr.color = mSpr.color; return(this); }
private void DrawDataUnitContent(PoolUnit <object> unit) { EditorGUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent(unit.Storage.GetType().Name), EditorStyles.textField); GUILayout.Label(new GUIContent(unit.CacheTag.ToString()), EditorStyles.toolbarPopup, GUILayout.Width(110)); } EditorGUILayout.EndHorizontal(); }
private void DrawAssetUnitSlot(string key, PoolUnit <Object> unit) { EditorGUILayout.BeginVertical("box"); { GUILayout.Label(new GUIContent(key)); DrawAssetUnitContent(unit); } EditorGUILayout.EndVertical(); }
private void DrawDataUnitSlot(string index, PoolUnit <object> unit) { EditorGUILayout.BeginVertical("box"); { GUILayout.Label(new GUIContent(index)); DrawDataUnitContent(unit); if (GUILayout.Button("Preview", EditorStyles.miniButton)) { previewHeader = index; SetPreviewData(unit.Storage); } } EditorGUILayout.EndVertical(); }
public GameObject GetObjectFromPool(string name, Vector3 position, Quaternion rotation) { if (!isPoolMade) { return(null); } GameObject spawnobj; if (!poolDictionary.ContainsKey(name)) { //Debug.LogError ("this key " + name + "doesnt exisaefowuhawfouhafoiht" + isPoolMade); return(null); } Stack <GameObject> poolStackMeta; poolStackMeta = poolDictionary [name]; if (poolStackMeta.Count == 0) { PoolUnit pu = GetSourcePoolObjectFromName(name); spawnobj = Instantiate(pu.prefab); spawnobj.name = name; spawnobj.transform.SetParent(pu.parent, false); } else { spawnobj = poolStackMeta.Pop(); } spawnobj.SetActive(true); spawnobj.transform.position = position; spawnobj.transform.rotation = rotation; return(spawnobj); }
public static void TurnOff(PoolUnit s) { s.gameObject.SetActive(false); }
// desde el principio de la cursada que te lo hago recordar :^) public static void TurnOn(PoolUnit s) { s.gameObject.SetActive(true); }
public void ReturnGeneric(PoolUnit generic) { myGenericPool.ReturnObject(generic); }
public GenericSpawner(Transform t, Pool <PoolUnit> pool, string path) { _myGeneric = Resources.Load <PoolUnit>("Prefabs/" + path); _transform = t; myGenericPool = pool; }