82 lines
1.7 KiB
C#
82 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace Beyond
|
|
{
|
|
|
|
public class SkipCanvas : MonoBehaviour
|
|
{
|
|
private static SkipCanvas s_instance;
|
|
public static SkipCanvas Instance => s_instance;
|
|
|
|
public SkipButton m_skipButton;
|
|
public CanvasGroup m_buttonGroup;
|
|
|
|
public Action m_OnSkip;
|
|
public Action m_OnPause;
|
|
public Action m_OnRestart;
|
|
public enum Mode
|
|
{
|
|
TOUCH, BUTTONS
|
|
}
|
|
|
|
public Mode m_mode = Mode.TOUCH;
|
|
|
|
public void OnSkip()
|
|
{
|
|
m_OnSkip?.Invoke();
|
|
Debug.Log("OnSkip");
|
|
}
|
|
|
|
public void OnPause()
|
|
{
|
|
m_OnPause?.Invoke();
|
|
Debug.Log("OnPause");
|
|
}
|
|
|
|
public void OnRestart()
|
|
{
|
|
m_OnRestart?.Invoke();
|
|
Debug.Log("OnRestart");
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (m_mode == Mode.TOUCH)
|
|
{
|
|
m_skipButton.gameObject.SetActive(true);
|
|
m_buttonGroup.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
m_skipButton.gameObject.SetActive(false);
|
|
m_buttonGroup.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (s_instance != null)
|
|
{
|
|
Destroy(gameObject);
|
|
Debug.LogError("SkipCanvas already exists! Destrying");
|
|
return;
|
|
}
|
|
|
|
s_instance = this;
|
|
gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|
|
} |