You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
623 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TogglePanel : MonoBehaviour
{
[SerializeField] protected GameObject panel;
[SerializeField] protected Animator animator;
private bool open;
public GameObject Panel => panel;
protected void SetOpen(bool open)
{
this.open = open;
UpdateAnimator();
}
public void UpdateAnimator()
{
animator.SetBool("Open", open);
}
public void Toggle()
{
SetOpen(!open);
}
public void Open() => SetOpen(true);
public void Close() => SetOpen(false);
}