public void Movement() { sinTRX.a = _amplitudeX; sinTRX.f = _frequencyX; sinTRX.extra = _t.position.y; sinTRY.a = _amplitudeY; sinTRY.f = _frequencyY; sinTRX.dt = sinTRY.dt = Time.deltaTime; if (_amplitudeX == 0) { Debug.Log("Y"); sinTRX.extra = _t.position.x; _t.position += new Vector3(0, _sinTableY.ReturnValue(_t.position.x)); } else if (_amplitudeY == 0) { Debug.Log("X"); _t.position += new Vector3(Mathf.Sin(_t.position.y * Mathf.PI * _frequencyX) * _amplitudeX * Time.deltaTime, 0); } else { Debug.Log("Both"); _t.position += new Vector3(_sinTable.ReturnValue(_t.position.y), _sinTableY.ReturnValue(_t.position.x)); } }
IEnumerator SpawnEnemies() { _actualRound++; //Nueva ronda _totalEnemies = _enemigosASpawnearPrimerasDiezRondas.ReturnValue(_actualRound); //Total de enemigos a spawnear int enemiesToSpawn = _totalEnemies; int enemiesCont = 0; while (enemiesCont < enemiesToSpawn) { int posToSpawn = Random.Range(0, _spawnPositions.Length); //Posicion en la que va a spawnear yield return(new WaitUntil(isPaused)); //nice workaround Enemy e = EnemySpawner.Instance.pool.GetObject(); e.transform.position = _spawnPositions[posToSpawn].position; e.transform.rotation = transform.rotation; e.setTarget(_target); e.setMananger(this); e.Subscribe(this); enemiesCont++; yield return(new WaitForSeconds(0.5f)); } }
void Awake() { _enemigosASpawnearPrimerasDiezRondas = new LookUpTable <int, int>(CalculateEnemiesToSpawn); for (int i = 1; i < 11; i++) { _enemigosASpawnearPrimerasDiezRondas.ReturnValue(i); } }