58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using MyFrameworkPure;
|
|
using CommonScript;
|
|
public class door_control : MonoBehaviour
|
|
{
|
|
[SerializeField] private MouseButton mouseButton = MouseButton.Left;
|
|
public bool 启用交互 = false;
|
|
public bool 是否开门 = false;
|
|
public GameObject 验电笔;
|
|
public string 开门动画;
|
|
public string 关门动画;
|
|
public Animator animator;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
EventTriggerListener.Get(transform.gameObject).onClick_Data += Onclick;
|
|
}
|
|
void Onclick(GameObject go,PointerEventData e) {
|
|
if (验电笔.activeSelf == true)
|
|
return;
|
|
if(e.button != (PointerEventData.InputButton)mouseButton)
|
|
return;
|
|
|
|
|
|
// 是否开门 = !是否开门;
|
|
if (启用交互 == true)
|
|
{//sssssssss
|
|
是否开门 = !是否开门;
|
|
if (是否开门 == true)
|
|
{
|
|
//是否开门 = false;
|
|
animator.Play(开门动画);
|
|
//是否开门 = false;
|
|
}
|
|
else
|
|
{
|
|
//是否开门 = true;
|
|
animator.Play(关门动画);
|
|
//是否开门 = true;
|
|
|
|
|
|
}
|
|
}
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|