48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using ZenFulcrum.EmbeddedBrowser;
|
|
|
|
public class follow : ToolBase
|
|
{
|
|
[SerializeField] Transform game;
|
|
[SerializeField] string name;
|
|
[SerializeField] Dialogue dialogue;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
//EventTriggerListener.Get(transform.gameObject).onClick += g =>
|
|
//{
|
|
|
|
//};
|
|
}
|
|
private void Update()
|
|
{
|
|
// 鼠标左键按下
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
// 从相机位置发射一条射线经过屏幕上的鼠标点击位置
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
|
|
// 声明一个射线碰撞信息类
|
|
RaycastHit hit;
|
|
|
|
// 进行碰撞检测
|
|
bool res = Physics.Raycast(ray, out hit);
|
|
|
|
// 如果产生了碰撞
|
|
if (hit.transform.name.Equals(name))
|
|
{
|
|
gameObject.SetActive(false);
|
|
dialogue.gameObject.SetActive(true);
|
|
dialogue.init("核对 10kVxoox 线xocox# 配变 0.4kV 低压综合配电铂名称对xxxx# 配变 0.4kV低压综合配电销外壳验电确无电压打开 xxxxx配变检卉 0.4kV411、412、413 出线分路开关确在合闻位置");
|
|
}
|
|
}
|
|
}
|
|
// Update is called once per frame
|
|
private void FixedUpdate()
|
|
{
|
|
transform.LookAt(game);
|
|
}
|
|
}
|