备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace game
{
public class PinballSwitcher : MonoBehaviour
{
public Animator m_Animator;
public string m_OpenAnimation;
public string m_CloseAnimation;
public GameObject m_Collider;
#region
private EventPinballSwitcherState m_State;
public bool IsOpen()
{
return m_State == EventPinballSwitcherState.Open;
}
#endregion
#region
public void OpenSwitcher(EventPinballSwitcherOpen data)
{
if (m_Animator != null && !string.IsNullOrEmpty(m_OpenAnimation))
{
m_Animator.Play(m_OpenAnimation);
m_State = EventPinballSwitcherState.Open;
}
if (m_Collider != null)
{
m_Collider.SetActive(false);
}
}
public void CloseSwitcher(EventPinballSwitcherClose data)
{
if (m_Animator != null && !string.IsNullOrEmpty(m_CloseAnimation))
{
m_Animator.Play(m_CloseAnimation);
m_State = EventPinballSwitcherState.Close;
}
if (m_Collider != null)
{
m_Collider.SetActive(true);
}
}
#endregion
#region
public void InitEvent()
{
FishingPinballAct.Subscribe<EventPinballSwitcherOpen>(OpenSwitcher);
FishingPinballAct.Subscribe<EventPinballSwitcherClose>(CloseSwitcher);
}
#endregion
#region
// Start is called before the first frame update
void Start()
{
InitEvent();
FishingPinballAct.Publish(new EventPinballSwitcherOpen());
}
#endregion
}
}