DET24-AtomCraft/AtomURP-main/Assets/Scripts/PokableButton.cs
2024-03-19 17:43:48 +01:00

41 lines
767 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PokableButton : MonoBehaviour
{
public GameObject board;
public float turnSpeed = 5f;
public void PokeButton()
{
// Make the button disappear
// gameObject.SetActive(false);
Destroy(gameObject);
// Change the board's position
board.transform.position = new Vector3(0, -0.617f, 4.33f);
}
private void OnTriggerEnter(Collider other)
{
// Check if the object entering the trigger is the player or any other object you want to interact with
if (other.CompareTag("Player"))
{
// Call the method to handle button poke
PokeButton();
}
}
}