34 lines
717 B
C#
34 lines
717 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
public class AgentInput : MonoBehaviour
|
|
{
|
|
[SerializeField] private Button attackButton;
|
|
|
|
public event Action OnAttack;
|
|
public UnityEvent OnAttackUnityEvent;
|
|
|
|
private void Awake()
|
|
{
|
|
if (attackButton != null)
|
|
{
|
|
attackButton.onClick.AddListener(HandleAttackButtonPressed);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning("Attack Button is not assigned in the Inspector.");
|
|
}
|
|
}
|
|
|
|
private void HandleAttackButtonPressed()
|
|
{
|
|
OnAttack?.Invoke();
|
|
|
|
OnAttackUnityEvent?.Invoke();
|
|
}
|
|
|
|
} |