public void SetType(EnemyParser.EnemyType type) { this.type = type; EnemyParser.EnemyInfo info = EnemyParser.GetEnemyInfo(type); weapon.SetDamage(info.damage); health.SetMax(info.health); reloadTime = info.reloadTime / 1000; Material pickedMaterial = null; foreach (var material in materials) { if (material.type != type) { continue; } pickedMaterial = material.material; break; } if (pickedMaterial != null) { meshRenderer.material = pickedMaterial; } }
private void KillEnemy(object sender, Health.HealthEventArgs e) { Health health = sender as Health; currentWave.Remove(health.transform.root.gameObject); health.OnDepletion -= KillEnemy; var controller = health.GetComponent <EnemyController>(); player.AddPoints(EnemyParser.GetEnemyInfo(controller.type).scoreGiven); if (currentWave.Count == 0) { ++currentMap; PrepareWave(); } }