E_ElecCompetition/Electrical_inspectionCompet.../Assets/Script/raycast/CheckCurrent.cs

70 lines
2.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CheckCurrent : MonoBehaviour
{
public Raycast_control raycast_Control;
public AudioSource audioSource;
public Transform ;
public Transform ;
public GameObject 使;
public GameObject ;
public HighlightingSystem.Highlighter highlighter;
private Vector3 startrot;
private Vector3 startpos;
public Vector3 originpos;
public Vector3 originrot;
// Start is called before the fir
// st frame update
void Start()
{
startrot = .transform.localEulerAngles;
startpos = .transform.localPosition;
}
private void OnEnable()
{
.transform.localPosition = originpos;
.transform.localEulerAngles = originrot;
}
// Update is called once per frame
void Update()
{
if (raycast_Control.hitgo != null) {
if (raycast_Control.hitgo.GetComponent<CurrentJudgment>())
{
if (raycast_Control.hitgo.GetComponent<CurrentJudgment>(). == true)
{ audioSource.gameObject.SetActive(true);
highlighter.constant = true;
}
.SetActive(false);
使.SetActive(true);
.transform.localEulerAngles = raycast_Control.hitgo.transform.forward;
.transform.position = raycast_Control.hitInfo.point;
.GetComponent<Collider>().enabled = true;
}
}
else
{
audioSource.gameObject.SetActive(false);
highlighter.constant = false;
.SetActive(true);
使.SetActive(false);
.transform.localPosition = startpos;
.transform.localEulerAngles = startrot;
.GetComponent<Collider>().enabled = false;
}
}
}