public void Unlock() { if (inventory.CanAfford(key.type, key.value)) { inventory.ApplyChange(key.type, key.value); OnUnlock?.Invoke(); } }
void CheckLevelUp(int new_level) { if (m_levels != null && new_level >= unlock_at) { m_levels.OnLevelUp -= CheckLevelUp; OnUnlock.AttemptCall(Item); } }
private void Unlock() { //partToRemoveWhenUnlocked.SetActive(false); unlocked = true; if (OnUnlock != null) { OnUnlock.Invoke(); } }
public void Unlock() { if (locked > 0) { locked--; if (locked == 0) { OnUnlock?.Invoke(); } } }
public void ReleaseLockAction(Guid guid) { lockActions.Remove(guid.ToString()); if (!isLocked) { return; } if (lockActions.Count == 0) { isLocked = false; OnUnlock?.Invoke(); } }
/// <summary> /// Unlocks the blueprints instantly. /// </summary> public void UnlockBuildingBlueprintsInstantly() { isUnlocked = true; OnUnlock?.Invoke(); campsiteModel.SetActive(false); foreach (BuildingBlueprint blueprint in buildingBlueprints) { if (blueprint.Building.IsBuilt) { blueprint.ShowBuilding(); } else { blueprint.ShowBlueprint(); } } }
/// <summary> /// Unlocks blueprints and shows the particle system. /// </summary> public void UnlockBuildingBlueprints() { isUnlocked = true; OnUnlock?.Invoke(); unlockPS.Play(); CoroutineManager.Instance.WaitForSeconds(unlockBuildingTimer, () => { campsiteModel.SetActive(false); foreach (BuildingBlueprint blueprint in buildingBlueprints) { if (blueprint.Building.IsBuilt) { blueprint.ShowBuilding(); } else { blueprint.ShowBlueprint(); } } }); }
private void UpdateLock() { float angle; if (!picking) { angle = Mathf.LerpAngle(lockPick.transform.localEulerAngles.z, 0, Time.unscaledDeltaTime * 8f); lockPick.transform.localRotation = Quaternion.Euler(0f, 0f, angle); return; } float distance = Mathf.Abs(Angle - (BobbyPinAngle - 360)); float maxDistance = Mathf.Max(Mathf.Abs(90 + Angle), Mathf.Abs(90 - Angle)); float influence = Mathf.Abs(3f + 90f * (1 - distance / maxDistance)); angle = Mathf.LerpAngle(lockPick.transform.localEulerAngles.z, influence, Time.unscaledDeltaTime * 4f); lockPick.transform.localRotation = Quaternion.Euler(0f, 0f, angle); if (lockPick.transform.localEulerAngles.z > 90 - Tolerance) { OnUnlock?.Invoke(this); } else if (Mathf.Abs(angle - influence) < 2f) { lockPick.transform.localRotation = Quaternion.Euler(0f, 0f, angle - 5f); Damage += 0.2f; } if (Damage > 3) { active = false; bobbyPin.SetActive(false); bobbyPinBreak.Play(); StartCoroutine(Reset()); } }
public void Unlock() { Unlocked = true; UpgradeAll(); OnUnlock.Invoke(); }