public void DisableLockpicking() { PlayerControls.lockpickingOn = false; for (int i = 0; i < oscilators.Count; i++) { Destroy(oscilators[i].gameObject); } lockableCaller = null; gameObject.SetActive(false); rotatingKeyhole.transform.rotation = Quaternion.Euler(0f, 0f, 0f); }
//oscilatorsCount needs to be between 1 and 4 public void SetupOscilators(int oscilatorsCount, ALockable rootLockable) { oscilators = new List <LockpickingOscilator>(); lockableCaller = rootLockable; lockpickingComplete = false; if ((oscilatorsCount > 4) || (oscilatorsCount < 1)) { Debug.LogError("Trying to setup lockpicking mechanism with wrong number of oscilators."); return; } for (int i = 0; i < oscilatorsCount; i++) { GameObject oscilator = Instantiate(oscilatorPrefab, layoutGroup.transform); oscilators.Add(oscilator.GetComponent <LockpickingOscilator>()); oscilator.GetComponent <LockpickingOscilator>().SetupRngIntervalPositions(); } correctSingleAngle = baseAngle / oscilatorsCount; almostSingleAngle = correctSingleAngle / 2; }
public void ToggleLockpicking(int oscilatorsCount, ALockable root) { lockpickingOn = true; lockpicking.SetupOscilators(oscilatorsCount, root); lockpicking.gameObject.SetActive(true); }