コード例 #1
0
 public bool IsRequiredPickup(ItemStats itemStats, int amount)
 {
     if (levelGoal.ContainsType(itemStats))
     {
         pickupsCollected += amount;
         CheckForVictory();
         return(true);
     }
     return(false);
 }
コード例 #2
0
        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);
        }