_xiaofang/xiaofang/Assets/Script/npc/RecuseNpc.cs
2024-10-22 11:57:50 +08:00

45 lines
934 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public enum NpcState
{
Injuried, //ÊÜÉË
Healthy//½¡¿µ
}
public class RecuseNpc : MonoBehaviour
{
private Button recusebtn;
private CharacterControl chain;
private NpcState ns = NpcState.Injuried;
private bool statebool = false;
private void Awake()
{
recusebtn = GameObject.Find("Canvas/Recuse").GetComponent<Button>();
}
private void OnTriggerEnter(Collider other)
{
if(other.name == "Man")
recusebtn.gameObject.SetActive(true);
chain = other.GetComponent<CharacterControl>();
if (statebool) return;
other.GetComponent<CharacterControl>().cha = this.gameObject ;
}
public void Setnpcstate(NpcState npcState)
{
this.transform.Translate(Vector3.forward);
Debug.Log("Setnpcstateµ÷ÓÃ");
}
}