Beispiel #1
0
 private bool calculateDrop(Ship ship)
 {
     if (Random.value <= .5f)
     {
         ItemType dropType = ItemTypeDescriptor.dropables()[Random.Range(0, ItemTypeDescriptor.dropables().Length)];
         loot.Add(Instantiate <Transform>(ItemFactory.itemPrefab).GetComponent <Item>().init(ItemFactory.createItemData(dropType)));
     }
     if (Random.value <= .75f)
     {
         loot.Add(Instantiate <Transform>(ItemFactory.itemPrefab).GetComponent <Item>().init(ItemFactory.createGoodsData(Random.Range(5, 20))));
     }
     if (Random.value <= .25f)
     {
         loot.Add(Instantiate <Transform>(ItemFactory.itemPrefab).GetComponent <Item>().init(ItemFactory.createGoodsData(Random.Range(5, 20))));
     }
     foreach (Item item in loot)
     {
         item.gameObject.SetActive(false);
     }
     return(loot.Count > 0);
 }