public void ForceSpawnMoney(Vector2Int spawnLoc, int amount) { GameObject moneyObj = ItemSpawner.SpawnMoney(spawnLoc); DroppedMoney newMoneyBloodMoney = moneyObj.GetComponent <DroppedMoney>(); newMoneyBloodMoney.Initialize(amount); // Set how much this is worth newMoneyBloodMoney.xPos = spawnLoc.x; newMoneyBloodMoney.zPos = spawnLoc.y; map[spawnLoc.x, spawnLoc.y].SetItemOnTile(newMoneyBloodMoney); }
private void SpawnMoneyAt(int x, int z) { GameObject moneyObj = ItemSpawner.SpawnMoney(new Vector2Int(x, z)); DroppedMoney newMoneyBloodMoney = moneyObj.GetComponent <DroppedMoney>(); int amount = SeededRandom.Range(10, 20); // Technically, the amount of money can change if you swap floors. Hopefully nobody notices. newMoneyBloodMoney.Initialize(amount); // Set how much this is worth newMoneyBloodMoney.xPos = x; newMoneyBloodMoney.zPos = z; map[x, z].SetItemOnTile(newMoneyBloodMoney); }
//Instantiates money and tries to place it. Might not actually get the input spot if the input spot is taken. public void SpawnMoneyOnTile(Vector2Int spawnLoc, int amount) { Vector2Int adjustedSpawnLoc = CurrentFloor.FindSpotForItem(spawnLoc, 2); // It might bounce. if (adjustedSpawnLoc.x == -1 && adjustedSpawnLoc.y == -1) { return; // money was lost to the void. } GameObject moneyObj = ItemSpawner.SpawnMoney(adjustedSpawnLoc); DroppedMoney newMoneyBloodMoney = moneyObj.GetComponent <DroppedMoney>(); newMoneyBloodMoney.Initialize(amount); // Set how much this is worth newMoneyBloodMoney.xPos = spawnLoc.x; newMoneyBloodMoney.zPos = spawnLoc.y; map[adjustedSpawnLoc.x, adjustedSpawnLoc.y].SetItemOnTile(newMoneyBloodMoney); }