forked from nope5166/AtomCraft-2.28
41 lines
767 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|