WXGame/Blacksmith/Assets/Script/UI/NPCTrigger.cs

60 lines
1011 B
C#
Raw Normal View History

2024-11-13 16:56:37 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class NPCTrigger : MonoBehaviour
{
public List<GameObject> open;
public List<GameObject> close;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void Open()
{
foreach (var obj in open)
{
obj.SetActive(true);
}
foreach (var obj in close)
{
obj.SetActive(false);
}
}
public void Close()
{
foreach (var obj in open)
{
obj.SetActive(false);
}
foreach (var obj in close)
{
obj.SetActive(true);
}
}
public void OnNPCEventEnter()
{
GameSystem.ins.SaveNPCbo(true);
}
public void OnNPCEventExit()
{
GameSystem.ins.SaveNPCbo(false);
}
}