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

70 lines
1.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CheckCurrent_wanyong : MonoBehaviour
{
public Raycast_control_wanyong raycast_Control;
// public AudioSource audioSource;
public Transform ;
private Vector3 startrot;
private Vector3 startpos;
// Start is called before the first frame update
void Start()
{
startrot = .transform.localEulerAngles;
startpos = .transform.localPosition;
}
/// <summary>
/// 另外一只笔
/// </summary>
public CheckCurrent_wanyong otherDevice;
/// <summary>
/// 在使用且有电
/// </summary>
public bool InPlaceAndHasEle=false;
public GameObject ;
// 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)
{
InPlaceAndHasEle = true;
// audioSource.gameObject.SetActive(true);
if (otherDevice.InPlaceAndHasEle)
{
.gameObject.SetActive(true);
}
}
.transform.localEulerAngles = raycast_Control.hitgo.transform.forward;
.transform.position = raycast_Control.hitInfo.point;
.GetComponent<Collider>().enabled = true;
}
}
else
{
// audioSource.gameObject.SetActive(false);
InPlaceAndHasEle = false;
.gameObject.SetActive(false);
.transform.localEulerAngles = startrot;
.transform.localPosition = startpos;
.GetComponent<Collider>().enabled = false;
}
}
}