ShanxiKnowledgeBase/SXElectricalInspection/Assets/GuYuan/AmmeterManager/AmmeterSon.cs

55 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class AmmeterSon : MonoBehaviour
{
public string name;
[SerializeField] AmmeterSon ammeterSon;
public bool Run = false;
public Vector3 newPos = Vector3.zero;
public Vector3 newAngle = Vector3.zero;
private void Start()
{
Debug.Log($"DoolsPlayer==={gameObject.name}");
}
private void OnMouseDown()
{
if (Run)
{
if (name == "ÂÝË¿")
{
GameObject obj = GameManager.Instance.temp;
if (obj != null && obj.name == "ÂÝË¿µ¶_¾øÔµ(Clone)")
{
GameManager.Instance.FirstPersonController.enabled = false;
obj.transform.DORotate(newAngle, 0.5f);
obj.transform.DOMove(newPos, 1f).OnComplete(() =>
{
gameObject.SetActive(false);
});
}
}
else
{
gameObject.SetActive(false);
if (ammeterSon != null)
{
ammeterSon.enabled = true;
ammeterSon.GetComponent<AmmeterSon>().Run = true;
}
}
}
}
public void OnOver()
{
gameObject.SetActive(false);
if (ammeterSon != null)
{
ammeterSon.enabled = true;
ammeterSon.GetComponent<AmmeterSon>().Run = true;
}
}
}