public override void Setup(EnemySetup enemySetup) { MaxHealth = _enemyInfo.HealthMultiplier * enemySetup.Health; _speed = _enemyInfo.SpeedMultiplier * enemySetup.Speed; _globalData = enemySetup.GlobalData; _player = enemySetup.Target; Tier = enemySetup.Tier; CurrentHealth = MaxHealth; Startup(); SetTierIcon(); }
private void SpawnChildren() { for (int i = 0; i < _enemyInfo.SpawnAmount; i++) { var temp = Instantiate(_offsprings); var angle = Random.Range(-1f, 1f); var setup = new EnemySetup(_speed, _player, MaxHealth, Tier, _globalData); temp.GetComponent <EnemyBehaviour>().Setup(setup); temp.GetComponent <EnemyBehaviour>().KnockBack(10f, new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)).normalized); temp.GetComponent <EnemyBehaviour>().Debuffs[StatusEffect.DebuffType.Knockback].IsAffected = true; } Destroy(transform.gameObject); }
void SpawnEnemy(int index) { var bounds = _map.localBounds; var position = new Vector3(Random.Range(bounds.min.x, bounds.max.x), Random.Range(bounds.min.y, bounds.max.y), 0); while (Vector3.Distance(CenterOfPlayers(), position) <= 5) { position = new Vector3(Random.Range(bounds.min.x, bounds.max.x), Random.Range(bounds.min.y, bounds.max.y), 0); } var enemy = Instantiate(_globalData.EnemyPrefabs[index], transform); enemy.transform.position = position; var setup = new EnemySetup( speed: Mathf.Log(_time + 100, 100F) * _multiplier, target: Players[Random.Range(0, Players.Count)], health: (Mathf.Log10(_time + 10) * _multiplier) * 10, tier: _tier % 35, globalData: _globalData ); enemy.GetComponent <EnemyBehaviour>().Setup(setup); }
public abstract void Setup(EnemySetup enemySetup);