-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIPanel.cs
42 lines (34 loc) · 856 Bytes
/
UIPanel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/* UIPanel
* inherits from MonoBehaviour
* abstract
* defines method for panels (initialise, refresh, ...)
*/
public abstract class UIPanel : MonoBehaviour
{
protected bool _isPanelActive { get; set; }
protected bool _isPaused { get; set; }
public abstract void Initialise();
public abstract void Refresh();
private void Start()
{
gameObject.SetActive(_isPanelActive);
}
public void Toggle()
{
Refresh();
_isPanelActive = !_isPanelActive;
this.gameObject.SetActive(_isPanelActive);
if (_isPaused)
Time.timeScale = 0.0f;
else
Time.timeScale = 1.0f;
}
public void Disable()
{
if (this)
gameObject.SetActive(false);
}
}