private void CreateBaseObject(Vector3 pos, string name) { IBufferable bufferable = SimpleBuffer.GetObject(name); Transform trm = bufferable.GetTransform(); trm.SetParent(this.GetTransform()); trm.localPosition = pos; }
public static IBufferable CreateObjectAtPoint(string name, Vector3 pos) { IBufferable bufferable = GetObject(name); if (bufferable != null) { Transform trm = bufferable.GetTransform(); trm.SetParent(null); trm.localPosition = pos; } return(bufferable); }
public BufferGroup(string name, Transform bufferTrm, int count = 1) { m_BufferTrm = bufferTrm; m_Prefab = Resources.Load <GameObject>(name); for (int i = 0; i < count; i++) { IBufferable bufferable = InstantiateOneObject(); Transform trm = bufferable.GetTransform(); if (trm != null) { trm.SetParent(m_BufferTrm); } m_DeactiveObjects.AddLast(bufferable); } }
public void ReturnObjectToBuffer(IBufferable bufferable) { if (m_ActiveObjects.Remove(bufferable)) { m_DeactiveObjects.AddLast(bufferable); Transform trm = bufferable.GetTransform(); if (trm != null) { trm.SetParent(m_BufferTrm); } } else { Debug.LogError("There is no such active object " + bufferable); } }