public void NextSectionSpawn(GameObject gameObject) { int oldIndex = index; if (!objectGenerater) { objectGenerater = new GameObject("AdvancedGenerator").AddComponent <ObjectGenerater>(); } if (isRandomSection) { index = UnityEngine.Random.Range(0, sectionDatas.Length - 1); } Section currentSection = sectionDatas[index].section; currentSection.Spawn(objectGenerater); index++; if (index >= sectionDatas.Length) { index = 0; } }
public ObjectBuffer(int initCapacity = 10, ObjectGenerater <T> creater = null, ObjectCleaner <T> destroier = null) { mBuffer = new T[initCapacity]; mLen = 0; mLock = new object(); Creater = creater; Destroier = destroier; }
public ObjectPool(int groups, int initCapacity = 10, ObjectGenerater <int, T> creater = null, ObjectCleaner <int, T> destroier = null) { mBuffer = new T[groups][]; mLen = new int[groups]; for (int i = 0; i < groups; i++) { mBuffer[i] = new T[initCapacity]; mLen[i] = 0; } mLock = new object(); Creater = creater; Destroier = destroier; }
public void Spawn(ObjectGenerater objectGenerater) { depth = 0; alreadySpawned = head ? true : false; if (alreadySpawned) { SectionTranslate(); } else { objectGenerater.Init(spawnData, minSpawnPos, maxSpawnPos); SectionSpawn(); } }
public void OnCheckPoint() { if (!isCatched && ghostString == string.Empty) { return; } objectGenerater = GameObject.Find("AdvancedGenerator").GetComponent <ObjectGenerater>(); catchablePooler = objectGenerater.catchablePooler; returnGhost = catchablePooler.GetPool(ghostString).GetComponentInChildren <CatchableGhost>(); returnGhost.OnCheckPoint(); animator.SetBool("catched", false); PickUpGhost.SetActive(false); isCatched = false; ghostString = string.Empty; }