private void NextZombygon() { if (_zombygonDatas.Count > 0) { _activeZombygon = _zombygonDatas[_activeZombygon.Sides - 4]; _renderer.sprite = _activeZombygon.ZombygonSprite; _health = _activeZombygon.Sides; _source.PlayOneShot(_enemySounds.damaged); } }
public void SetZombygonData(ZombygonData zombygon) { _dataSet = true; _activeZombygon = zombygon; if (_aiPath != null) { _aiPath.pickNextWaypointDist = _activeZombygon.MovementRate * 2; } _health = _activeZombygon.Sides; _renderer = GetComponent <SpriteRenderer>(); _renderer.sprite = _activeZombygon.ZombygonSprite; _chanceToDropLoot = _activeZombygon.ChanceToDropLoot; }
public bool SpawnEnemy(ZombygonData data, string spawnPointName) { foreach (var spawnPoint in SpawnPoints) { if (spawnPoint.name == spawnPointName) { var enemy = _enemyPooler.GetObject(); Enemies.Add(enemy); var offset = Random.insideUnitCircle * spawnPoint.Radius; var point = spawnPoint.transform.position + (Vector3)offset; if (Vector3.Distance(ThePlayer.transform.position, point) < 8) { return(false); } enemy.transform.position = point; enemy.SetZombygonData(data); return(true); } } Debug.LogWarning($"No spawn point named {spawnPointName} skipping spawning of object."); return(true); }