using System.Collections; using System.Collections.Generic; using UnityEngine; public class LootTable : MonoBehaviour { public List specialLootItems; public List defaultLootItems; public void SpawnLoot() { float r = Random.value; Debug.LogWarning(r); Vector3 spawnLocation = this.transform.position; spawnLocation.y += 3; if ( r > 0.50) //%50 percent chance -> special loot chance + default loot { int specialloot = Random.Range(0, specialLootItems.Count); int defaultloot = Random.Range(0, defaultLootItems.Count); Debug.LogWarning("special loot spawned"); Instantiate(specialLootItems[specialloot], spawnLocation, Quaternion.identity); Instantiate(defaultLootItems[defaultloot], spawnLocation, Quaternion.identity); } if (r > 0.2) //%80 percent chance -> default loot chance loot chance { Debug.LogWarning("default loot spawned"); int defaultloot = Random.Range(0, defaultLootItems.Count); Instantiate(defaultLootItems[defaultloot], this.transform); } } }