Files
racesm/Assets/Scripts/Garage.cs
2024-04-21 19:00:09 +02:00

57 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Garage : MonoBehaviour
{
public Button HotrodButton;
public GameObject HotrodGarage;
public Button RacecarButton;
public GameObject RacecarGarage;
public Button FordButton;
public GameObject FordGarage;
// Start is called before the first frame update
void Start()
{
HotrodButton.onClick.AddListener(SelectHotrod);
RacecarButton.onClick.AddListener(SelectRacecar);
FordButton.onClick.AddListener(SelectFord);
disable();
HotrodGarage.SetActive(true);
}
void enable()
{
HotrodGarage.SetActive(true);
RacecarGarage.SetActive(true);
FordGarage.SetActive(true);
}
void disable()
{
HotrodGarage.SetActive(false);
RacecarGarage.SetActive(false);
FordGarage.SetActive(false);
}
void SelectHotrod()
{
disable();
HotrodGarage.SetActive(true);
}
void SelectRacecar()
{
disable();
RacecarGarage.SetActive(true);
}
void SelectFord()
{
disable();
FordGarage.SetActive(true);
}
}