public void SpawnPowerUp(Vector3 position) { int roll = (int)(Random.value * 100); if (roll < pickupChance) { PowerUpFactory.Dispatch(position); } }
public void DestroyEnemy(GameObject enemy) { if (DifficultyCurve.Levels[UserData.CurrentLevel].Length != 1) { SpawnPowerUp(enemy.transform.position); } else // If the enemy is a boss, then spawn pickup with a worth equal to the # of the level (i.e : Boss 3 drops is worth 9 powerups) { PowerUpFactory.Dispatch(enemy.transform.position); } UserData.IncreaseLevelPoints(enemy.GetComponent <EnemyBehaviour>().GetPointsValue()); ExplosionFactory.Dispatch(enemy.transform.position); EnemyFactory.Return(enemy); mActiveEnemies.Remove(enemy); mActiveEnemies.TrimExcess(); }