void Start() { _singleton = this; code = RandomizeCode(); foreach (var kvButton in buttons) { kvButton.button.onClick.AddListener(delegate { AddToDisplay(kvButton.number); }); } }
public void KillTarget() { SoundManager.Instance.Play("Kill"); var code = CodeMission.Instance().RandomizeCode(); codeText.text = "Code : " + code; parentTarget.SetActive(false); parentCode.SetActive(true); targetIsAlive = false; StartCoroutine(nameof(KillTargetCo)); }
public void RaycastInteractiveElement() { int layerMask = 1 << 8; layerMask = ~layerMask; if (!canClick) { return; } Ray ray; #if UNITY_STANDALONE ray = cam.ScreenPointToRay(Input.mousePosition); #else ray = cam.ScreenPointToRay(middleScreen); #endif RaycastHit hit; if (Physics.Raycast(ray, out hit, 200f, layerMask)) { switch (hit.transform.gameObject.tag) { case "ToKillAgent": if (hit.transform.gameObject.tag.Contains("ToKillAgent")) { if (hit.distance < 2.0f) { if (IsSomeoneWatching()) { if (gameManager.IsTutorial()) { gameManager.ReplacePlayerOnStartPosition(); } else { gameManager.CinematicPlayerDie(); } } else { if (ProgressionManager.GetWealthValue() > 0.99f) { gameManager.CinematicWinGame(); } else { NavMeshAgentManager.Instance().CopsGoOnCrimeScene(); gameManager.KillTarget(); if (gameManager.IsTutorial()) { TutorialManager.Instance().NextStep(); } } } } } break; case "Orb": if (hit.transform.parent.CompareTag("Orb")) { Destroy(hit.transform.parent.gameObject); } else { Destroy(hit.transform.gameObject); } OrbManager.IncrementOrb(UnityEngine.Random.Range(0f, 1f) < .5f); break; case "InteractiveElement": Vector3 origin = hit.transform.position; Destroy(hit.transform.gameObject); break; case "TargetRoomDoor": if (!gameManager.IsTargetAlive()) { CodeMission.Instance().OpenMissionPanel(); } break; case "LaptopInfo": PCMission.Instance().OpenMissionPanel(); break; case "ElevatorDoor": if (!gameManager.IsDataRetrieve()) { return; } if (gameManager.IsTutorial()) { if (TutorialManager.Instance().GetStep() == 6) { gameManager.EndTutorial(); return; } } gameManager.GoToNextFloor(hit.transform.parent.gameObject); break; } } }
public void ConfirmCode() { CodeMission.Instance().ConfirmCode(codeDisplay); }