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;
}
///
/// 另外一只笔
///
public CheckCurrent_wanyong otherDevice;
///
/// 在使用且有电
///
public bool InPlaceAndHasEle=false;
public GameObject 灯;
// Update is called once per frame
void Update()
{
if (raycast_Control.hitgo != null) {
if (raycast_Control.hitgo.GetComponent())
{
if (raycast_Control.hitgo.GetComponent().是否带电 == 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().enabled = true;
}
}
else
{
// audioSource.gameObject.SetActive(false);
InPlaceAndHasEle = false;
灯.gameObject.SetActive(false);
交互点.transform.localEulerAngles = startrot;
交互点.transform.localPosition = startpos;
交互点.GetComponent().enabled = false;
}
}
}