187 lines
5.2 KiB
C#
187 lines
5.2 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 玩家相机
|
|
/// </summary>
|
|
public Transform Cameraobj;
|
|
|
|
/// <summary>
|
|
/// 警告按钮
|
|
/// </summary>
|
|
public Button ExclamationPointBtn;
|
|
|
|
bool isclick;
|
|
|
|
/// <summary>
|
|
/// 上梯子后坐标
|
|
/// </summary>
|
|
public Transform UptheladderPos;
|
|
|
|
/// <summary>
|
|
/// 打开封印
|
|
/// </summary>
|
|
bool isOpenLock;
|
|
|
|
/// <summary>
|
|
/// 透明盖子
|
|
/// </summary>
|
|
public Transform Transparentover;
|
|
|
|
/// <summary>
|
|
/// 透明盖子上的两颗螺丝
|
|
/// </summary>
|
|
public GameObject[] screw;
|
|
|
|
/// <summary>
|
|
/// 判断封印盒子是否在手上
|
|
/// </summary>
|
|
bool isbox = true;
|
|
|
|
/// <summary>
|
|
/// 透明盖子上的封印cube碰撞
|
|
/// </summary>
|
|
public BoxCollider[] BOXseal;
|
|
|
|
/// <summary>
|
|
/// 柜门卡栓碰撞
|
|
/// </summary>
|
|
public BoxCollider guimenkashuan;
|
|
|
|
/// <summary>
|
|
/// 透明盖子上的封印
|
|
/// </summary>
|
|
public GameObject[] parentoverSeal;
|
|
|
|
/// <summary>
|
|
/// 电箱门
|
|
/// </summary>
|
|
public GameObject guimen;
|
|
|
|
/// <summary>
|
|
/// 门锁01
|
|
/// </summary>
|
|
public GameObject mensuo01;
|
|
|
|
/// <summary>
|
|
/// 柜门box碰撞
|
|
/// </summary>
|
|
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<AnimationProcessManager>().HandleClick(hit.collider.gameObject.name);
|
|
|
|
|
|
}
|
|
if (hit.collider.gameObject.name == "透明盖子封印碰撞R")
|
|
{
|
|
if (isbox)
|
|
{
|
|
parentoverSeal[0].gameObject.SetActive(true);
|
|
isbox = false;
|
|
}
|
|
MotionEngine.GetModule<AnimationProcessManager>().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<AnimationProcessManager>().HandleClick(hit.collider.gameObject.name);
|
|
}
|
|
if (hit.collider.gameObject.name == "柜门卡栓")
|
|
{
|
|
StartCoroutine(IEguimenkashuan());
|
|
//if (isbox)
|
|
//{
|
|
guimenbox.GetComponent<BoxCollider>().enabled = true;
|
|
isbox = false;
|
|
// }
|
|
MotionEngine.GetModule<AnimationProcessManager>().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<AnimationProcessManager>().HandleClick(hit.collider.gameObject.name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 用户离开npc警告按钮消失
|
|
/// </summary>
|
|
/// <param name="other"></param>
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.name == "Man_stand")
|
|
{
|
|
ExclamationPointBtn.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 透明外盖上的封印
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 点击柜门卡栓动画
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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);
|
|
|
|
}
|
|
}
|