MIF_E31211986/Assets/Script/ButtonLeftRight.cs

40 lines
813 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonLeftRight : MonoBehaviour
{
public Button[] buttonRotasi; // 0 left 1 right
public static GameObject targetRotasi;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void TargetFound(GameObject targetObject)
{
for (int i = 0; i < buttonRotasi.Length; i++)
{
buttonRotasi[i].interactable = true;
}
targetRotasi = targetObject;
}
public void TargetLost()
{
for (int i = 0; i < buttonRotasi.Length; i++)
{
buttonRotasi[i].interactable = false;
}
}
}