NetworkStatsMenu.cs 942 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Rendering.PostProcessing;
  5. public class NetworkStatsMenu : MonoBehaviour
  6. {
  7. public CanvasGroup leaderboard;
  8. public PostProcessVolume pp;
  9. DepthOfField depthOfField;
  10. float defaultDof;
  11. void Start()
  12. {
  13. pp.profile.TryGetSettings(out depthOfField);
  14. defaultDof = depthOfField.focusDistance;
  15. }
  16. public float leaderboardOpacity= 0;
  17. void Update()
  18. {
  19. if(Input.GetKey(KeyCode.Tab)){
  20. leaderboardOpacity = Mathf.Lerp(leaderboardOpacity, 1, 0.1f);
  21. }else{
  22. leaderboardOpacity = Mathf.Lerp(leaderboardOpacity, 0, 0.1f);
  23. }
  24. if(leaderboardOpacity < 0.1f){leaderboardOpacity=0;}
  25. leaderboard.alpha = leaderboardOpacity;
  26. // depthOfField.focusDistance.value = (1-leaderboardOpacity) * defaultDof;
  27. }
  28. }