12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityGameFramework.Runtime;
- /// <summary>
- /// 场景组件 大门
- /// </summary>
- public class SceneEventGateLogic : MonoBehaviour
- {
- public bool isEntry = false;
- private void Awake()
- {
-
- }
- // Start is called before the first frame update
- void Start()
- {
- }
- public void OnTriggerEnter(Collider collider)
- {
- Role role = collider.GetComponent<Role>();
- if(role && role.IsTeamLeader)
- {
- isEntry = true;
- SceneEventAreaLockLogic areaLock;
- if (this.TryGetComponent<SceneEventAreaLockLogic>(out areaLock))
- {
- if(areaLock.IsUnlockDoor)
- {
- OpenDoor();
- }
- }
- }
- }
- public void OpenDoor()
- {
- if(isEntry)
- {
- Animator anim = this.GetComponent<Animator>();
- anim.Play("open");
- }
- }
- public void OnTriggerExit(Collider collider)
- {
- //Role role = collider.GetComponent<Role>();
- //if (role)
- //{
- // isEntry = false;
- // Animator anim = this.GetComponent<Animator>();
- // anim.Play("close");
- //}
- }
- public void EnableCollider()
- {
- }
- public void OnClickInteractive()
- {
-
- }
- }
|