void Spawn() { GameObject foodSpawned = FoodObjectPooling.Spawn(objectPrefab); xSpawn = Random.Range(-21, 21); //randomly generate x position between 2 numbers ySpawn = Random.Range(-21, 21); //randomly generate y position between 2 numbers inArena = false; //obj coord is not in arena if ((borderTop.transform.position.y > ySpawn && borderBottom.transform.position.y < ySpawn) && (borderLeft.transform.position.x < xSpawn && borderRight.transform.position.x > xSpawn)) { //check if the generated coord is inside the arena inArena = true; //obj coord is not in area foodSpawned.transform.position = new Vector3(xSpawn, ySpawn); } }
IEnumerator InitializePool() { if (!isObjectPooled) { UIGameController.Instance.ShowNotificationMessage(LanguageManager.Instance.GetMessage("LOA0012")); yield return(new WaitForSeconds(0.1f)); foodPool = FoodObjectPooling.Instance; fishPool = FishObjectPooling.Instance; predatorPool = PredatorObjectPooling.Instance; isObjectPooled = true; } yield return(null); GameController.Instance.StartListeningForSocketUpdates(); }