57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
|
|
public class ClampAmmetersInteractive : MonoBehaviour
|
|
{
|
|
public bool isInteractive;
|
|
public GameObject g1;
|
|
public string name;
|
|
public float linearMeasure;//默认的大小
|
|
public List<float> floats;
|
|
public string Fuan;
|
|
public string unit;
|
|
private void Start()
|
|
{
|
|
transform.AddComponent<MeshCollider>();
|
|
}
|
|
[ContextMenu("运行")]
|
|
void init()
|
|
{
|
|
g1 = transform.GetChild(0).GetComponent<Transform>().gameObject;
|
|
//Destroy(g1.GetComponent<MeshFilter>());
|
|
//Destroy(g1.GetComponent<MeshRenderer>());
|
|
//Destroy(g1.GetComponent<BoxCollider>());
|
|
}
|
|
private void OnMouseDown()
|
|
{
|
|
//Debug.Log("ok");
|
|
if (GameManager.ins.temp.transform != null && GameManager.ins.temp.transform.name.Equals("钳形电流表(Clone)") || GameManager.ins.temp.transform.name.Equals("钳形电流表_大(Clone)"))
|
|
{
|
|
GameManager.ins.DianFuIm.gameObject.SetActive(true);
|
|
GameManager.ins.temp.transform.parent = g1.transform;
|
|
GameManager.ins.temp.transform.DOLocalRotate(new Vector3(47.52f,0,53.88f), 0.25f);
|
|
GameManager.ins.temp.transform.DOScale(new Vector3(50,50,50), 0.25f);
|
|
GameManager.ins.temp.transform.DOLocalMove(new Vector3(1.42f,-6.02f,8.35f), 0.25f);
|
|
GameManager.ins.DianFuTex.text = Fuan +" "+ unit;
|
|
for (int i = 0; i < floats.Count; i++)
|
|
{
|
|
|
|
if (floats[(int)(GameManager.ins.QianStopValve.Sum / 10)]> linearMeasure)
|
|
{
|
|
GetComponent<Fraction>().CompletedorNot = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown("t"))
|
|
{
|
|
Debug.Log(GameManager.ins.DianFuTex.text + "==== GameManager.ins.DianFuTex.text");
|
|
}
|
|
}
|
|
}
|