コード例 #1
0
 public void Unlock()
 {
     if (inventory.CanAfford(key.type, key.value))
     {
         inventory.ApplyChange(key.type, key.value);
         OnUnlock?.Invoke();
     }
 }
コード例 #2
0
 void CheckLevelUp(int new_level)
 {
     if (m_levels != null && new_level >= unlock_at)
     {
         m_levels.OnLevelUp -= CheckLevelUp;
         OnUnlock.AttemptCall(Item);
     }
 }
コード例 #3
0
    private void Unlock()
    {
        //partToRemoveWhenUnlocked.SetActive(false);
        unlocked = true;

        if (OnUnlock != null)
        {
            OnUnlock.Invoke();
        }
    }
コード例 #4
0
 public void Unlock()
 {
     if (locked > 0)
     {
         locked--;
         if (locked == 0)
         {
             OnUnlock?.Invoke();
         }
     }
 }
コード例 #5
0
 public void ReleaseLockAction(Guid guid)
 {
     lockActions.Remove(guid.ToString());
     if (!isLocked)
     {
         return;
     }
     if (lockActions.Count == 0)
     {
         isLocked = false;
         OnUnlock?.Invoke();
     }
 }
コード例 #6
0
ファイル: Campsite.cs プロジェクト: 100unity/InSaneSurvival
 /// <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();
         }
     }
 }
コード例 #7
0
ファイル: Campsite.cs プロジェクト: 100unity/InSaneSurvival
 /// <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();
             }
         }
     });
 }
コード例 #8
0
    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());
        }
    }
コード例 #9
0
 public void Unlock()
 {
     Unlocked = true;
     UpgradeAll();
     OnUnlock.Invoke();
 }