void Update() { detect(); if (isDetected) { myEvent.Invoke(this.GetType()); //envoie un évènement quand un geste est détecté, avec en argument le type de geste isDetected = false; } }
private void Update() { // Check for wave launching times if (this.waveIndex < this.level.launchTimes.Count && this.currentLevelTime >= this.level.launchTimes[this.waveIndex]) { // Launch Wave if (this.waveIndex < this.level.launchTimes.Count - 1) { // Wave number waveIndex this.waveTimeSnapshot = this.currentLevelTime + this.level.launchTimes[this.waveIndex + 1] - this.level.launchTimes[this.waveIndex]; } this.GetEnemiesInWave(this.waveIndex); this.initiateEnemieWaveCreation = true; this.EnemyTimer(); this.waveIndex++; } // Check for enemy creating times in a wave if (this.initiateEnemieWaveCreation) { if ((this.enemyIndex < this.enemiesNumber) && (this.currentLevelTime >= this.enemyCreateTimer)) { EnemyTimer(); //this.OnCreateEnemyEvent?.Invoke(this.WaveIndex, this.enemyIndex); GameObject newEnemy = Instantiate(this.level.waves[wave].waveEnemies[enemyIndex]); this.enemyIndex++; } else if (this.enemyIndex == this.enemiesNumber) { this.initiateEnemieWaveCreation = false; this.enemyIndex = 0; // next wave this.wave++; } } // Calculate When is the next wave if game not paused if (this.waveIndex < this.level.launchTimes.Count) { floatEvent.Invoke(this.TimeTillNextWave(this.waveTimeSnapshot)); } else { stringEvent.Invoke("Last Wave !!!"); } // Current level time this.currentLevelTime = Time.time - this.levelStartTime; }
public void OnEventRaised(T value) { Response?.Invoke(value); }