110 lines
3.2 KiB
C#
110 lines
3.2 KiB
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 쭁介독
|
|
/// </summary>
|
|
public class Screwdriver : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 쭁介독麟깃
|
|
/// </summary>
|
|
public Transform ScrewdriverTrans;
|
|
|
|
/// <summary>
|
|
/// 塘긋쭁介
|
|
/// </summary>
|
|
public Transform ScrewR;
|
|
|
|
/// <summary>
|
|
/// 璘긋쭁介
|
|
/// </summary>
|
|
public Transform ScrewL;
|
|
|
|
public InteractiveObjects[] interactiveObjects;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (Input.GetMouseButtonDown(0))
|
|
{//Camera.transform.forward
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit hit;
|
|
bool raycast = Physics.Raycast(ray, out hit);
|
|
if (raycast)
|
|
{
|
|
if (hit.collider.gameObject.name == "맨_미땍쭁介_Rup")
|
|
{
|
|
StartCoroutine(Rscrew());
|
|
Debug.Log(hit.collider.gameObject.name);
|
|
}
|
|
if (hit.collider.gameObject.name == "미땍쭁介_Ldown")
|
|
{
|
|
StartCoroutine(Lscrew());
|
|
Debug.Log(hit.collider.gameObject.name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 塘긋쭁介
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
IEnumerator Rscrew()
|
|
{
|
|
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, 90),1f);
|
|
yield return new WaitForSeconds(1.5f);
|
|
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.2373f, 1.8549f, -1.244f), 1f);
|
|
yield return new WaitForSeconds(1);
|
|
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, -104.747f), 1f);
|
|
yield return new WaitForSeconds(1.5f);
|
|
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.191f, 1.831f, -1.158f), 1f);
|
|
yield return new WaitForSeconds(2f);
|
|
ScrewR.transform.DOLocalMove(new Vector3(0.1316f, 0.036f, 0.0034f), 1.5f);
|
|
yield return new WaitForSeconds(3f);
|
|
Destroy(ScrewR);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 璘긋쭁介
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
IEnumerator Lscrew()
|
|
{
|
|
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, 90), 1f);
|
|
yield return new WaitForSeconds(1.5f);
|
|
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, -104.747f), 1f);
|
|
yield return new WaitForSeconds(1.5f);
|
|
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.2373f, 1.8284f, -1.3885f), 1f);
|
|
yield return new WaitForSeconds(1.5f);
|
|
|
|
ScrewL.transform.DOLocalMove(new Vector3(-0.07357633f, -0.01137948f, -0.0366f), 1f);
|
|
}
|
|
//private void OnMouseEnter()
|
|
//{
|
|
// for (int i= 0; i < interactiveObjects.Length; i++)
|
|
// {
|
|
// interactiveObjects[i].enabled = true;
|
|
// }
|
|
|
|
//}
|
|
//private void OnMouseExit()
|
|
//{
|
|
// for (int i = 0; i < interactiveObjects.Length; i++)
|
|
// {
|
|
// interactiveObjects[i].enabled = false;
|
|
// }
|
|
//}
|
|
|
|
|
|
}
|