zombie_mp/Assets/Scripts/Menu/NetworkStatsMenu.cs
2021-09-17 06:04:39 +05:30

33 lines
942 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public class NetworkStatsMenu : MonoBehaviour
{
public CanvasGroup leaderboard;
public PostProcessVolume pp;
DepthOfField depthOfField;
float defaultDof;
void Start()
{
pp.profile.TryGetSettings(out depthOfField);
defaultDof = depthOfField.focusDistance;
}
public float leaderboardOpacity= 0;
void Update()
{
if(Input.GetKey(KeyCode.Tab)){
leaderboardOpacity = Mathf.Lerp(leaderboardOpacity, 1, 0.1f);
}else{
leaderboardOpacity = Mathf.Lerp(leaderboardOpacity, 0, 0.1f);
}
if(leaderboardOpacity < 0.1f){leaderboardOpacity=0;}
leaderboard.alpha = leaderboardOpacity;
// depthOfField.focusDistance.value = (1-leaderboardOpacity) * defaultDof;
}
}