82 lines
2.1 KiB
C#
82 lines
2.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Device_Base : PermanentTriggerBase
|
|
{
|
|
/// <summary>
|
|
/// 设备类型
|
|
/// </summary>
|
|
public DeviceType deviceType;
|
|
/// <summary>
|
|
/// trigger触发事件
|
|
/// </summary>
|
|
public Func<string, bool, int> triggerAction;
|
|
/// <summary>
|
|
/// 是否正在移动
|
|
/// </summary>
|
|
public bool isMoving;
|
|
|
|
private Vector3 head_LocalPos;
|
|
private Vector3 head_LocalEulerAnglesl;
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
if (GameManager.RunModelMgr.SceneType == E_SceneType.Site)
|
|
{
|
|
base.OnAwake();
|
|
}
|
|
}
|
|
protected override void OnStart()
|
|
{
|
|
if (GameManager.RunModelMgr.SceneType == E_SceneType.Site)
|
|
{
|
|
base.OnStart();
|
|
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
|
}
|
|
}
|
|
|
|
protected override void OnMEnter()
|
|
{
|
|
if (GameManager.RunModelMgr.SceneType == E_SceneType.Site && GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
|
{
|
|
base.OnMEnter();
|
|
_highlight.SetHighlighted(true);
|
|
}
|
|
}
|
|
protected override void OnMExit()
|
|
{
|
|
if (GameManager.RunModelMgr.SceneType == E_SceneType.Site && GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
|
{
|
|
base.OnMExit();
|
|
_highlight.SetHighlighted(false);
|
|
}
|
|
}
|
|
|
|
public void AddTriggerAction(Func<string, bool, int> action)
|
|
{
|
|
this.triggerAction = action;
|
|
}
|
|
|
|
public void AddStartAction(Action callback)
|
|
{
|
|
hand_out_action += callback;
|
|
}
|
|
public void AddEndAction(Action callback)
|
|
{
|
|
hand_back_action += callback;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置工具回到手中的位置
|
|
/// </summary>
|
|
/// <param name="head_LocalPos"></param>
|
|
/// <param name="head_LocalEulerAnglesl"></param>
|
|
public void SetHeadPosAndEulerang(Vector3 head_LocalPos, Vector3 head_LocalEulerAnglesl)
|
|
{
|
|
this.head_LocalPos = head_LocalPos;
|
|
this.head_LocalEulerAnglesl = head_LocalEulerAnglesl;
|
|
}
|
|
}
|