void OnInteract() { if (isLocked) { if (code != null && code != "") { DialACode.Instance.Init(gameObject, code); } else { if (key != null && InventoryManager.PlayerInventory.Find(obj => obj.name == key.name) != null) { Unlock(); } else { if (safeLevel < Globals.Instance.playerData.strength + player.GetComponent <BaseCharacter>().strengthBonus) { Unlock(); UIManager.Notify("You used your unnatural strength to force the safe"); } else { UIManager.Notify("This lock seems stronger than usual.."); } if (trap != null) { trap.ApplyDamage(); } } } } else { if (_open) { Close(); } else { Open(); } } }
public void OnInteract() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } if (isLocked) { if (key != null) { if (player.GetComponent <BaseCharacter>().inventory.Find(obj => obj.name == key.name)) { Unlock(); UIManager.Notify("You have used the key to open this door"); } else { if (doorLevel < Globals.Instance.playerData.strength + player.GetComponent <BaseCharacter>().strengthBonus) { Unlock(); UIManager.Notify("You used your unnatural strength to force the door"); } else { UIManager.Notify("This lock seems stronger than usual.."); } if (trap != null) { trap.ApplyDamage(); } } } else { UIManager.Notify("This door is locked"); } } else { Open(!isOpen); } }