41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
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);
|
||
}
|
||
}
|
||
}
|