Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

40 行
1.1 KiB

using System;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering.Universal.Path2D.GUIFramework
{
internal class ClickAction : HoveredControlAction
{
private int m_Button;
private bool m_UseEvent;
public Action<IGUIState, Control> onClick;
public ClickAction(Control control, int button, bool useEvent = true) : base(control)
{
m_Button = button;
m_UseEvent = useEvent;
}
protected override bool GetTriggerContidtion(IGUIState guiState)
{
return guiState.mouseButton == m_Button && guiState.eventType == EventType.MouseDown;
}
protected override void OnTrigger(IGUIState guiState)
{
base.OnTrigger(guiState);
if (onClick != null)
onClick(guiState, hoveredControl);
if (m_UseEvent)
guiState.UseCurrentEvent();
}
protected override bool GetFinishContidtion(IGUIState guiState)
{
return true;
}
}
}