public bool IsRequiredPickup(ItemStats itemStats, int amount) { if (levelGoal.ContainsType(itemStats)) { pickupsCollected += amount; CheckForVictory(); return(true); } return(false); }
private void OnLevelLoaded(string levelName) { levelGoal = Resources.Load <LevelGoal>(levelName); enemiesKilled = 0; pickupsCollected = 0; enemiesToKill = FindObjectsOfType <EnemyHealth>().Length; IPickupableItem[] pickups = FindObjectsOfType <Pickup>(); pickupsToCollect = pickups .Where(p => levelGoal.ContainsType(p.ItemInfo)) .Sum(p => p.Amount); }