using DG.Tweening; using System.Collections; using System.Collections.Generic; using DefaultNamespace.ProcessMode; using MotionFramework; using UnityEngine; using UnityEngine.UI; using HighlightPlus; public class Fieldobservation : MonoBehaviour { /// /// 玩家相机 /// public Transform Cameraobj; /// /// 警告按钮 /// public Button ExclamationPointBtn; bool isclick; /// /// 上梯子后坐标 /// public Transform UptheladderPos; /// /// 打开封印 /// bool isOpenLock; /// /// 透明盖子 /// public Transform Transparentover; /// /// 透明盖子上的两颗螺丝 /// public GameObject[] screw; /// /// 判断封印盒子是否在手上 /// bool isbox = true; /// /// 透明盖子上的封印cube碰撞 /// public BoxCollider[] BOXseal; /// /// 柜门卡栓碰撞 /// public BoxCollider guimenkashuan; /// /// 透明盖子上的封印 /// public GameObject[] parentoverSeal; /// /// 电箱门 /// public GameObject guimen; /// /// 门锁01 /// public GameObject mensuo01; /// /// 柜门box碰撞 /// public BoxCollider guimenbox; public GameObject fengy; //public HighlightEffect _highlight; void Start() { } void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; bool raycast = Physics.Raycast(ray, out hit); if (raycast) { if (hit.collider.gameObject.name == "盖_透明外壳") { StartCoroutine(IEparentoverSeal()); BOXseal[0].enabled = true; BOXseal[1].enabled = true; //isbox = false; MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } if (hit.collider.gameObject.name == "透明盖子封印碰撞R") { if (isbox) { parentoverSeal[0].gameObject.SetActive(true); isbox = false; } MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } if (hit.collider.gameObject.name == "透明盖子封印碰撞L") { if (isbox) { parentoverSeal[1].gameObject.SetActive(true); guimenkashuan.enabled = true; isbox = false; } MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } if (hit.collider.gameObject.name == "柜门卡栓") { StartCoroutine(IEguimenkashuan()); //if (isbox) //{ guimenbox.GetComponent().enabled = true; isbox = false; // } MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } if (hit.collider.gameObject.name == "电柜门封印box碰撞") { fengy.gameObject.SetActive(true); fengy.transform.localPosition = new Vector3(0.6371536f, 0.02661133f, -0.01525164f); MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } } } } /// /// 用户离开npc警告按钮消失 /// /// private void OnTriggerExit(Collider other) { if (other.name == "Man_stand") { ExclamationPointBtn.gameObject.SetActive(false); } } /// /// 透明外盖上的封印 /// /// IEnumerator IEparentoverSeal() { Transparentover.transform.localPosition=new Vector3(0, 0, 0); yield return new WaitForSeconds(1f); screw[0].gameObject.SetActive(true); yield return new WaitForSeconds(0.5f); screw[0].transform.localPosition = new Vector3(-0.07357633f, -0.01137948f, 0.003414989f); screw[1].gameObject.SetActive(true); yield return new WaitForSeconds(1.5f); screw[1].transform.localPosition = new Vector3(0.07394123f, 0.013731f, 0.003414989f); } /// /// 点击柜门卡栓动画 /// /// IEnumerator IEguimenkashuan() { guimen.gameObject.transform.DOLocalRotate(new Vector3(-90, 0, 0), 1); yield return new WaitForSeconds(1.1f); mensuo01.gameObject.transform.DOLocalRotate(new Vector3(0, 0, 0), 1); } }