Example #1
0
 private void Awake()
 {
     // Get the iron ingot's data, and add it to the dictionary
     items.Add("Iron", itemDatabase.GetItem("Iron"));
     // Get the sword's data, and add it to the dictionary
     items.Add("Sword", itemDatabase.GetItem("Sword"));
     // Get the sword's recipe, and add it to the dictionary
     recipes.Add("Sword", recipeDatabase.GetCraftingRecipe("Sword"));
     // Add iron to the inventory
     inventory.AddItem(items["Iron"], 6);
 }
Example #2
0
        private void Awake()
        {
            // Get the coin from the database
            QI_Currency coin = currencyDatabase.GetCurrency("Coin");

            // Add 5 coins to each vendor. The player is technically a vendor, because they are able to buy and sell items
            player.AddCurrency(coin, 5);
            shopkeeper.AddCurrency(coin, 5);
            // Get the sword's data, and add it to the dictionary
            sword = itemDatabase.GetItem("Sword");
            // Add a sword to each vendor
            player.Inventory.AddItem(sword, 1);
            shopkeeper.Inventory.AddItem(sword, 1);
        }
 // Start is called before the first frame update
 void Start()
 {
     items.Add("Health Potion", itemDatabase.GetItem("Health Potion"));
     items.Add("ShipEngine1", itemDatabase.GetItem("ShipEngine1"));
     items.Add("ShipWeapon1", itemDatabase.GetItem("ShipWeapon1"));
     items.Add("ShipGenerator1", itemDatabase.GetItem("ShipGenerator1"));
     items.Add("PlayerWeapon1", itemDatabase.GetItem("PlayerWeapon1"));
     inventory.AddItem(items["Health Potion"], 1);
     inventory.AddItem(items["ShipEngine1"], 1);
     inventory.AddItem(items["ShipWeapon1"], 1);
     inventory.AddItem(items["ShipGenerator1"], 1);
     inventory.AddItem(items["PlayerWeapon1"], 1);
 }
Example #4
0
 public void SpawnObjects(int timeOfDay)
 {
     if (timeOfDay != hourToDailySpawn)
     {
         return;
     }
     foreach (var point in spawnPoints)
     {
         var hit = Physics2D.OverlapCircle(point.position, .05f);
         if (hit == null)
         {
             var go = Instantiate(itemDatabase.GetItem(objectToSpawn).ItemPrefab, point.position, Quaternion.identity);
             if (go.TryGetComponent(out SaveableEntity entity))
             {
                 entity.GenerateId();
             }
         }
     }
 }
 private void Awake()
 {
     // Get the health potion's data, and add it to the dictionary
     items.Add("Health Potion", itemDatabase.GetItem("Health Potion"));
 }