_xiaofang/xiaofang/Assets/Script/npc/RecuseNpc.cs

45 lines
934 B
C#
Raw Normal View History

2024-10-21 18:09:07 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
2024-10-22 11:57:50 +08:00
public enum NpcState
{
Injuried, //<2F><><EFBFBD><EFBFBD>
Healthy//<2F><><EFBFBD><EFBFBD>
}
2024-10-21 18:09:07 +08:00
public class RecuseNpc : MonoBehaviour
{
private Button recusebtn;
2024-10-22 11:57:50 +08:00
private CharacterControl chain;
private NpcState ns = NpcState.Injuried;
private bool statebool = false;
private void Awake()
2024-10-21 18:09:07 +08:00
{
recusebtn = GameObject.Find("Canvas/Recuse").GetComponent<Button>();
}
private void OnTriggerEnter(Collider other)
{
2024-10-22 11:57:50 +08:00
if(other.name == "Man")
2024-10-21 18:09:07 +08:00
recusebtn.gameObject.SetActive(true);
2024-10-22 11:57:50 +08:00
chain = other.GetComponent<CharacterControl>();
if (statebool) return;
other.GetComponent<CharacterControl>().cha = this.gameObject ;
}
2024-10-21 18:09:07 +08:00
2024-10-22 11:57:50 +08:00
public void Setnpcstate(NpcState npcState)
{
this.transform.Translate(Vector3.forward);
Debug.Log("Setnpcstate<74><65><EFBFBD><EFBFBD>");
}
2024-10-21 18:09:07 +08:00
}