2023-06-12 14:07:20 +02:00

33 lines
831 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class keyWhenPressed : MonoBehaviour
{
public GameObject objectToActivate;
public ButtonDOne ButtonDOne;
public ButtonDOne ButtonDTwo;
public ButtonDOne ButtonDThree;
private bool isActivated;
private void Awake()
{
// Disable the object by default
objectToActivate.SetActive(false);
}
private void Update()
{
bool eins = ButtonDOne.einsAn;
bool zwei = ButtonDTwo.zweiAn;
bool drei = ButtonDThree.dreiAn;
// Check if all three conditions are true and the object is not yet activated
if (eins && zwei && drei && !isActivated)
{
// Activate the object
objectToActivate.SetActive(true);
isActivated = true;
}
}
}