public void UnLockView( ) { foreach (var item in toDisable) { item.enabled = true; } controlsLockedReminder.SetActive(false); locked = false; LockedWithVanessa = false; LockedWithGroundskeeper = false; LockedWithBathroomAttendant = false; LockedWithBathroomDoor = false; LockedWithForint = false; LockedWithTurul = false; LockedWithMilk = false; LockedWithCatPuzzle = false; LockedWithCandyBowl = false; LockedWithCandyPuzzle = false; LockedWithCharlie = false; LockedWithSink = false; LockedWithBlankGrave = false; LockedWithLock = false; LockedWithMausoleum = false; LockedWithStillClock = false; LockedWithCreepyClock = false; LockedWithTreeOfLife = false; LockedWithEngravedGrave = false; LockedWithBasin = false; LockedWithTorch = false; LockedWithPinwheel = false; LockedWithFlowerPot = false; lockedWithNPC = false; randomWord = null; lockedWithGround = false; randomWordBool = false; ambientInteractable = false; textGraphic.SetActive(false); //charliesTextGraphic.SetActive(false); // ForintTextGraphic.SetActive(false); }
private void TryToLockView( ) { // Did we hit something? if (!Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, mask)) { Debug.Log("Lock View Hit Nothing/Went to infinity"); return; } // Is it within out max distance? if (Vector3.Distance(character.transform.position, hit.collider.gameObject.transform.position) > 10.0f) { Debug.Log("Lock View Hit " + hit.transform.name + ", but it is beyond the max distance"); return; } Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit); if (hit.transform.tag == "NPC") { lockedWithNPC = true; } else if (hit.transform.tag == "Ground") { lockedWithGround = true; } if (hit.transform.name == "Vanessa") { LockedWithVanessa = true; if (PuzzleManagement.PlayerIsDoingElementsPuzzle && !InventoryItemManager.playerHasFan) { InventoryItemManager.playerHasFan = true; obtainFanFromVanessaComment.start(); inventoryItemManagerScript.SetItem(PlayerItem.Fan, true); Debug.Log("You should have the fan in your inventory"); } } else if (hit.transform.name == "Charlie" && !AnItemIsBeingHeld) { LockedWithCharlie = true; if (PuzzleManagement.PlayerIsDoingSicknessPuzzle) { MouseClicks.currentCorrectAnswer = "gyógyszert"; textGraphic.transform.position = hit.transform.position; Vector3 correction = new Vector3(0, 0.35f, -2.0f); textGraphic.transform.position += correction; textGraphic.SetActive(true); if (!DialogManager.PlayerHasAskedForMedicine) { DialogueWithCharlie.AskingForMedicine.start(); DialogManager.PlayerHasAskedForMedicine = true; } else { DialogueWithCharlie.StillDontKnowWordForMedicine.start(); } } else if (PuzzleManagement.PlayerIsDoingElementsPuzzle && !InventoryItemManager.playerHasLighter) { InventoryItemManager.playerHasLighter = true; inventoryItemManagerScript.SetItem(PlayerItem.Lighter, true); obtainLighterFromCharlieComment.start(); Debug.Log("You should have the lighter in your inventory"); } else { DialogueWithCharlie.IDontFeelWell.start(); } } else if (hit.transform.name == "Groundskeeper") { LockedWithGroundskeeper = true; MouseClicks.currentCorrectAnswer = "fürdőszoba"; if (!DialogManager.PlayerHasAskedWhereTheBathroomIs) { dialogueWithGroundskeeperScript.PlayerAsksWhereTheBathroomIs(); } else if (dialogueWithVanessaScript.learnedFurduszoba) { dialogueWithGroundskeeperScript.PlayerAttemptsToSayBathroomToGroundskeeper(); } } else if (hit.transform.name == "Bathroom Attendant") { LockedWithBathroomAttendant = true; } else if (hit.transform.name == "forint") { MouseClicks.currentCorrectAnswer = "forint"; LockedWithForint = true; if (!DialogManager.BathroomAttendantSaidToGetForint) { LeaveForintOnTheGround.start(); } else if (DialogManager.BathroomAttendantSaidToGetForint) { textGraphic.transform.position = Forint.transform.position; Vector3 correction = new Vector3(0, 0.35f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); } } else if (hit.transform.name == "BathroomDoor") { LockedWithBathroomDoor = true; } else if (hit.transform.name == "Turul") { Debug.Log("Player is doing bathroom puzzle? " + PuzzleManagement.PlayerIsDoingBathroomPuzzle); Debug.Log("Player is doing cat puzzle? " + PuzzleManagement.PlayerIsDoingCatPuzzle); LockedWithTurul = true; if (PuzzleManagement.PlayerIsDoingBathroomPuzzle) { TurulSingleSquawk.start(); } else if (PuzzleManagement.PlayerIsDoingCatPuzzle) { turulSFXScript.TurulSaysMilkTejSound.start(); turulSFXScript.HandleTurulSFXAndEvents(); } else if (PuzzleManagement.PlayerIsDoingSicknessPuzzle) { turulSFXScript.TurulSaysMedicineSound.start(); turulSFXScript.HandleTurulSFXAndEvents(); } else if (PuzzleManagement.PlayerIsDoingCandyPuzzle) { turulSFXScript.TurulSaysCandySound.start(); turulSFXScript.HandleTurulSFXAndEvents(); } else if (PuzzleManagement.PlayerIsDoingElementsPuzzle) { turulSFXScript.TurulSaysFireWaterEarthWindSound.start(); turulSFXScript.HandleTurulSFXAndEvents(); } } else if (hit.transform.name == "Milk") { textGraphic.transform.position = milk.transform.position; Vector3 correction = new Vector3(0, 0.55f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); MouseClicks.currentCorrectAnswer = "tej"; LockedWithMilk = true; } else if (hit.transform.name == "CatPuzzle") { LockedWithCatPuzzle = true; } else if (hit.transform.name == "Candy Bowl") { MouseClicks.currentCorrectAnswer = "cukorkát"; textGraphic.transform.position = CandyBowl.transform.position; Vector3 correction = new Vector3(0, 0.35f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); LockedWithCandyBowl = true; } else if (hit.transform.name == "CandyPuzzle") { LockedWithCandyPuzzle = true; } else if (hit.transform.name == "Shovel") { InventoryItemManager.playerHasShovel = true; shovel.SetActive(false); IHaveAShovel.start(); } else if (hit.transform.name == "VanessasBlankGrave" || hit.transform.name == "PlayersBlankGrave" || hit.transform.name == "CharliesBlankGrave") { LockedWithBlankGrave = true; ambientInteractable = true; BlankGraveComment.start(); } else if (hit.transform.name == "GraveFront" || hit.transform.name == "Charlies Grave" || hit.transform.name == "Vanessas Grave") { LockedWithEngravedGrave = true; ambientInteractable = true; FilledInGravesComment.start(); } else if (hit.transform.name == "CreepyClock") { CreepyClockComment.start(); } if (hit.transform.name == "Lock") { LockedWithLock = true; ambientInteractable = true; LockComment.start(); } else if (hit.transform.name == "Left Wall" || hit.transform.name == "Right Wall" || hit.transform.name == "Front Wall" || hit.transform.name == "Back Wall") { LockedWithMausoleum = true; ambientInteractable = true; if (PuzzleManagement.PlayerIsDoingBathroomPuzzle) { StillMausoleumComment.start(); } else { BangingMausoleumComment.start(); } } else if (hit.transform.name == "GhostParticleSystem") { IgnoreTheGhostComment.start(); } else if (hit.transform.name == "stillClock") { LockedWithStillClock = true; ambientInteractable = true; StillClockComment.start(); } else if (hit.transform.name == "CreepyClock") { LockedWithCreepyClock = true; ambientInteractable = true; } else if (hit.transform.name == "Tree of Life") { LockedWithTreeOfLife = true; ambientInteractable = true; TreeOfLifeComment.start(); } else if (hit.transform.name == "FlowerPot") { if (PuzzleManagement.FlowerPotSolved) { LockedWithFlowerPot = true; MouseClicks.currentCorrectAnswer = "föld"; textGraphic.transform.position = gameObject.transform.position; Vector3 correction = new Vector3(0, 0.65f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); } else { LockedWithFlowerPot = true; } } else if (hit.transform.name == "Torch") { if (PuzzleManagement.TorchSolved) { LockedWithTorch = true; MouseClicks.currentCorrectAnswer = "Tűz"; textGraphic.transform.position = gameObject.transform.position; Vector3 correction = new Vector3(0, 0.65f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); } else { LockedWithTorch = true; } } else if (hit.transform.name == "PinwheelLeafs") { if (PuzzleManagement.PinwheelSolved) { LockedWithPinwheel = true; MouseClicks.currentCorrectAnswer = "szél"; textGraphic.transform.position = gameObject.transform.position; Vector3 correction = new Vector3(0, 0.65f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); } else { LockedWithPinwheel = true; } LockedWithPinwheel = true; } else if (hit.transform.name == "Basin") { if (PuzzleManagement.WaterBasinSolved) { LockedWithBasin = true; MouseClicks.currentCorrectAnswer = "víz"; textGraphic.transform.position = gameObject.transform.position; Vector3 correction = new Vector3(0, 0.65f, 0); textGraphic.transform.position += correction; textGraphic.SetActive(true); } else { LockedWithBasin = true; } } // Did we hit something we can interact with? ItemInteraction interactionScript = hit.collider.gameObject.GetComponent <ItemInteraction>( ); if (interactionScript) { PlayerItem returnedItem = interactionScript.TryInteracting(itemInHand); if (returnedItem != itemInHand) { inventory.RemoveItem(itemInHand); HoldItem(PlayerItem.None, null); inventory.GiveItem(returnedItem); } } else if (itemInHand == PlayerItem.Phone) { usePhone.Invoke( ); } // Does it have a RandomWords on it? if (hit.collider.gameObject.GetComponent <RandomWordWorkaround>() != null) { randomWord = hit.collider.gameObject.GetComponent <RandomWordWorkaround>(); randomWordBool = true; } else { randomWord = null; randomWordBool = false; } //return if we hit something not interactable if (!randomWordBool && !lockedWithNPC && !lockedWithGround && !ambientInteractable) { return; } foreach (var item in toDisable) { item.enabled = false; } locked = true; controlsLockedReminder.SetActive(true); if (locked) { // Debug.Log("successful lock with: " + hit.transform.name); } else { // Debug.Log("unsuccessful lock"); } }