GQ_Communicate/GQ_TongXin/Assets/Adam/Scripts/DeviceItem.cs

41 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
//============================================================
//支持中文文件使用UTF-8编码
//@author #AUTHOR#
//@create #CREATEDATE#
//@company #COMPANY#
//
//@description:给生成设备添加的脚本
//============================================================
public class DeviceItem : MonoBehaviour
{
public DeviceManager deviceManager;
public int startIndex;
public int volume;
public DragTest1 oriPrefab;
// Use this for initialization
public void Init(DeviceManager _deviceManager, int _startIndex, int _volume, DragTest1 _dtPrefab)
{
gameObject.AddComponent<BoxCollider>();
deviceManager = _deviceManager;
startIndex = _startIndex;
volume = _volume;
oriPrefab = _dtPrefab;
}
private void OnMouseDown()
{
if (!EventSystem.current.IsPointerOverGameObject())
{
Vector3 pos = Input.mousePosition;
deviceManager.SetMenuValue(pos, this, oriPrefab);
}
}
}