public void TryOpen(PlayerGear playerGear) { if (playerGear.Buy(cost)) { anim.Play("Open"); opened = true; GameManager.Instance.UpdateAccessibleRooms(this); } else { Debug.Log("Not enough money to open door"); } }
public override void Interact(GameObject playerRoot) { PlayerGear playerMoney = playerRoot.GetComponent <PlayerGear>(); if (playerMoney) { if (playerMoney.Buy(repairCost)) { repairBarricade(); } else { Debug.Log("Not enough money to repair"); } } else { Debug.LogError("Can't find PlayerGear in " + playerRoot.name); } }
public override void Interact(GameObject playerRoot) { PlayerShooter playerShooter = playerRoot.GetComponent <PlayerShooter>(); PlayerGear playerGear = playerRoot.GetComponent <PlayerGear>(); if (playerShooter && playerGear) { if (playerGear.Buy(weaponPrefab.data.cost)) { playerShooter.PickUpWeapon(weaponPrefab); } else { Debug.Log("Not enough money to buy " + weaponPrefab.data.name); } } else { Debug.LogError("Can't find PlayerShooter or PlayerGear in " + playerRoot.name); } }