Пример #1
0
        /// <summary>
        /// Setups the item lists. Called from the influence map
        /// </summary>
        public void SetItemLists(SmartSpawnScriptableObject so)
        {
            itemPrefabs.Clear();
            spawnChances.Clear();

            itemPrefabs.AddRange(so.itemPrefab);
            spawnChances.AddRange(so.spawnChance);
        }
Пример #2
0
 /// <summary>
 /// Influences the item lists. Called from the SmartSpawnInfluenceMap.
 /// </summary>
 public void InfluenceItemLists(SmartSpawnScriptableObject so)
 {
     //Loop through all the stuff in the thing that's trying to influence us
     //If we have the same item, then change its chance, if we don't, then
     //add it
     for (int i = 0; i < so.itemPrefab.Length; i++)
     {
         if (itemPrefabs.Contains(so.itemPrefab[i]))
         {
             //Debug.Log("Item " + itemPrefabs[itemPrefabs.IndexOf(so.itemPrefab[i])].name + " spawn chance was: " + spawnChances[itemPrefabs.IndexOf(so.itemPrefab[i])]);
             spawnChances[itemPrefabs.IndexOf(so.itemPrefab[i])] += so.spawnChance[i];
             //Debug.Log("Item " + itemPrefabs[itemPrefabs.IndexOf(so.itemPrefab[i])].name + " spawn chance changed to: " + spawnChances[itemPrefabs.IndexOf(so.itemPrefab[i])]);
         }
         else
         {
             itemPrefabs.Add(so.itemPrefab[i]);
             spawnChances.Add(so.spawnChance[i]);
             //Debug.Log("Added " + so.itemPrefab[i].name);
         }
     }
 }