mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
added brightness method
This commit is contained in:
@@ -8,7 +8,6 @@ public class MenuPanelSwitch : MonoBehaviour
|
||||
[SerializeField] private GameObject MainPanel, JoinPanel, HostPanel, OptionsPanel;
|
||||
|
||||
[SerializeField] private Button JoinBtn, HostBtn, OptionsBtn;
|
||||
private Button BackBtn;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -23,7 +22,9 @@ public class MenuPanelSwitch : MonoBehaviour
|
||||
HostPanel.SetActive(false);
|
||||
OptionsPanel.SetActive(false);
|
||||
|
||||
SetBackgroundBrightness(1f);
|
||||
MainPanel.SetActive(true);
|
||||
|
||||
}
|
||||
|
||||
public void TurnAllOff()
|
||||
@@ -32,24 +33,32 @@ public class MenuPanelSwitch : MonoBehaviour
|
||||
HostPanel.SetActive(false);
|
||||
OptionsPanel.SetActive(false);
|
||||
MainPanel.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public void SwitchJoinPanel()
|
||||
{
|
||||
TurnAllOff();
|
||||
SetBackgroundBrightness(0.5f);
|
||||
JoinPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void SwitchHostPanel()
|
||||
{
|
||||
TurnAllOff();
|
||||
SetBackgroundBrightness(0.5f);
|
||||
HostPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void SwitchOptionsPanel()
|
||||
{
|
||||
TurnAllOff();
|
||||
SetBackgroundBrightness(0.5f);
|
||||
OptionsPanel.SetActive(true);
|
||||
}
|
||||
|
||||
void SetBackgroundBrightness(float b) // 0.0 -> 1
|
||||
{
|
||||
GetComponent<Image>().color = new Color(b, b, b);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user