43 lines
966 B
C#
43 lines
966 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// ǯÐÎǯÐεçÁ÷±í
|
|
/// </summary>
|
|
public class ClampAmmeters : MonoBehaviour
|
|
{
|
|
//private Vector3 offset;
|
|
//public void MouseDown()
|
|
//{
|
|
// offset = GetMouseWorldPos();
|
|
//}
|
|
public LayerMask clickableLayer;
|
|
public bool isok = false;
|
|
public void Start()
|
|
{
|
|
clickableLayer.value = 6;
|
|
}
|
|
public void Update()
|
|
{
|
|
if (Input.GetMouseButton(0))
|
|
{
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit hitInfo;
|
|
|
|
if (Physics.Raycast(ray, out hitInfo))
|
|
{
|
|
Transform trans = GameManager.ins.NameContrast(hitInfo.collider.name);
|
|
if (trans != null)
|
|
{
|
|
transform.position = trans.position;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|