140 lines
3.4 KiB
C#
140 lines
3.4 KiB
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Fieldobservation : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 玩家相机
|
|
/// </summary>
|
|
public Transform Cameraobj;
|
|
|
|
/// <summary>
|
|
/// 警告按钮
|
|
/// </summary>
|
|
public Button ExclamationPointBtn;
|
|
|
|
///// <summary>
|
|
///// 封印动画
|
|
///// </summary>
|
|
//public SkinnedMeshRenderer SkinnedMeshRenderer;
|
|
|
|
bool isclick;
|
|
|
|
/// <summary>
|
|
/// 上梯子后坐标
|
|
/// </summary>
|
|
public Transform UptheladderPos;
|
|
|
|
///// <summary>
|
|
///// 梯子点位
|
|
///// </summary>
|
|
//public Transform LadderPos;
|
|
|
|
///// <summary>
|
|
///// 变电箱门锁
|
|
///// </summary>
|
|
//public Transform Doorlock;
|
|
|
|
///// <summary>
|
|
///// 变电箱左门
|
|
///// </summary>
|
|
//public Transform DoorOfCabinet;
|
|
|
|
/// <summary>
|
|
/// 打开封印
|
|
/// </summary>
|
|
bool isOpenLock;
|
|
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(OpenLock());
|
|
|
|
// Debug.Log(hit.collider.gameObject.name);
|
|
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
///// <summary>
|
|
///// 打开封印动画
|
|
///// </summary>
|
|
///// <returns></returns>
|
|
//IEnumerator OpenLock()
|
|
//{
|
|
// for (int i = 0; i < 100; i++)
|
|
// {
|
|
// yield return new WaitForSeconds(0.01f);
|
|
// SkinnedMeshRenderer.SetBlendShapeWeight(0, i);
|
|
// }
|
|
// yield return new WaitForSeconds(1f);
|
|
// SkinnedMeshRenderer.gameObject.transform.DOLocalMove(new Vector3(0.637f, 0.12f, -0.015f),0.5f);
|
|
// yield return new WaitForSeconds(2f);
|
|
// Destroy(SkinnedMeshRenderer);
|
|
// StartCoroutine(OpenDoor());
|
|
//}
|
|
//IEnumerator OpenDoor()
|
|
//{
|
|
// yield return new WaitForSeconds(1f);
|
|
// Doorlock.transform.DOLocalRotate(new Vector3(160, 0, 0), 2f);
|
|
// yield return new WaitForSeconds(3f);
|
|
// DoorOfCabinet.transform.DOLocalRotate(new Vector3(-90, 160, 0), 2f);
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 柜门先后动画
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
//IEnumerator OpenDoor()
|
|
//{
|
|
// Doorlock069.DOLocalRotate(new Vector3(150, 0, 0), 1f);
|
|
// yield return new WaitForSeconds(2f);
|
|
// LeftDoor.DOLocalRotate(new Vector3(150, 0, 0), 2f);
|
|
//}
|
|
|
|
///// <summary>
|
|
///// 用户触发
|
|
///// </summary>
|
|
///// <param name="other"></param>
|
|
//private void OnTriggerEnter(Collider other)
|
|
//{
|
|
// if (other.name == "LadderPos")
|
|
// {
|
|
// UpladderBtn.gameObject.SetActive(true);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 用户离开npc警告按钮消失
|
|
/// </summary>
|
|
/// <param name="other"></param>
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.name == "Man_stand")
|
|
{
|
|
ExclamationPointBtn.gameObject.SetActive(false);
|
|
}
|
|
//if (other.name == "LadderPos")
|
|
//{
|
|
// UpladderBtn.gameObject.SetActive(false);
|
|
//}
|
|
|
|
}
|
|
}
|