IEnumerator SpawnCheeseAway(GameObject spawn) { yield return(new WaitForSeconds(Random.Range(0.5f, 1f))); float altCheese = Random.Range(1.8f, -2.5f); float max = spawn.transform.position.y - 0.8f; float min = spawn.transform.position.y + 0.8f; if (max > 1.5f) { max = 1.8f; } if (min < -2.4f) { min = -2.4f; } ISpawnable iPreFab = (ISpawnable)prefabCheese.GetComponent(typeof(ISpawnable)); iPreFab.setMovSpeed(movBallon); Instantiate(iPreFab.getPreFab(), new Vector3(spawn.transform.position.x + (DisInstance / 2), altCheese, 0), Quaternion.identity); }
private void spawnCheeseGroup(GameObject spawn) { float altCheese = Random.Range(1f, -1.5f); ISpawnable iPreFab = (ISpawnable)prefabCheeseGroupOndu.GetComponent(typeof(ISpawnable)); iPreFab.setMovSpeed(movBallon); Instantiate(iPreFab.getPreFab(), new Vector3(spawn.transform.position.x + DisInstance, altCheese, 0), Quaternion.identity); }
IEnumerator atkDragon() { yield return(new WaitForSeconds(Random.Range(1.8f, 2.2f))); ISpawnable iPreFab = (ISpawnable)dragonAtk.GetComponent(typeof(ISpawnable)); iPreFab.setMovSpeed(movBallon * 2); Instantiate(iPreFab.getPreFab(), new Vector3(transform.position.x - 1.4f, transform.position.y, transform.position.z), Quaternion.identity); StartCoroutine(atkDragon()); }
private void criaInstancia(ISpawnable iPreFab, GameObject spawn) { float maxAltura = iPreFab.getMaxAltura(); float max = spawn.transform.position.y + maxAltura; float min = spawn.transform.position.y - (1f * maxAltura); if (isPlayerBased) { max = objPlayer.transform.position.y + 0.4f; min = objPlayer.transform.position.y - 0.4f; } if (max > 1.8f) { max = 1.8f; } if (min < -2.4f) { min = -2.4f; } float distCheese = 0f; if (spwCheese) { spwCheese = false; distCheese = 10f * (movBallon / 2); spawnCheeseGroup(spawn); } contaSpawn++; altura = Random.Range(max, min); iPreFab.setMovSpeed(movBallon); iPreFab.setMoving(isMoving); Instantiate(iPreFab.getPreFab(), new Vector3(spawn.transform.position.x + DisInstance + distCheese, altura, 0), Quaternion.identity); }