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); }
private bool TryPickupMoney(Player player, DroppedMoney droppedMoney) { return(this.CanPickup(player, droppedMoney) && droppedMoney.TryPickUpBy(player)); }
// Checks the target tile for anything that activates when you move onto it. EG: items, terrain // Returns true if we should still move. private bool ActivateMoveOntoEffects(Vector2Int newMoveTarget) { var tile = BattleManager.instance.GetTileAtLocation(newMoveTarget.x, newMoveTarget.y); //Pick up any money that we ended our turn on top of var itemType = tile.tileItemType; switch (itemType) { case Tile.TileItemType.money: DroppedMoney moneyobj = tile.GetItemOnTile() as DroppedMoney; if (moneyobj != null) { Debug.Log("Picked up money"); AudioManager.PlayPickMoney(); Money += moneyobj.Value; moneyobj.DestroySelf(); tile.tileItemType = Tile.TileItemType.empty; } break; case Tile.TileItemType.smallChest: TreasureChest treasureObj = tile.GetItemOnTile() as TreasureChest; if (treasureObj != null) { AudioManager.PlayChestOpening(); } { // loot boxes babbbyyyyyyyyy int randomTreasurePull = UnityEngine.Random.Range(0, 4); switch (randomTreasurePull) { case 0: // coins int randomAmountOfCoins = UnityEngine.Random.Range(18, 37); puim.ShowAlert("You found " + randomAmountOfCoins + " coins in the chest."); Money += randomAmountOfCoins; break; case 1: puim.ShowAlert("You found a card reward in this chest."); GetCardReward(0); break; case 2: case 3: Card hanaFuda = CardFactory.GetCardTheme("hanafuda").GetRandomCardInTheme(); hanaFuda.Owner = this; GainInventoryCard(hanaFuda); puim.ShowAlert("You found the hanfuda card \"" + hanaFuda.CardInfo.Name + "\". Press V to open your inventory."); break; } treasureObj.DestroySelf(); tile.tileItemType = Tile.TileItemType.empty; } break; } if (tile.tileTerrainType == Tile.TileTerrainType.trap) { var trap = tile.terrainOnTile as Trap; if (trap != null) { trap.Activate(); } } else if (tile.tileTerrainType == Tile.TileTerrainType.stairsDown) { GoDownStairsEffects(); BattleGrid.instance.GoDownFloor(); TurnManager.instance.CurrentPhase = TurnManager.TurnPhase.start; TurnManager.instance.CurrentTurn = TurnManager.WhoseTurn.player; } return(true); }