해결된 질문
작성
·
233
2
public class InputManager
{
public Action<Define.MouseEvent> MouseAction = null;
public void OnUpdate()
{
if(MouseAction != null)
{
if (Input.GetMouseButton(0))
{
MouseAction.Invoke(Define.MouseEvent.Press);
_pressed = true;
}
else
{
if (_pressed)
{
MouseAction.Invoke(Define.MouseEvent.Click);
_pressed = false;
}
}
}
}
}
위 코드에서 if(MouseAction != null) 이 잘 이해되지 않습니다. 제일 위에서 public Action<Define.MouseEvent> MouseAction = null;로 MouseAction을 null로 초기화 했으니 if(MouseAction != null) 는 작동하지 않아야 하는 거 아닌가요..?
답변 1
2
Managers.Input.MouseAction += OnMouseClicked;
말씀이시군요. 감사합니다!