Added slideshow (disabled, but fully functional, not actually part of the player experience, just for fun). Moved teleport button for bolt car onto its front. Added signs for barred areas and server entry guiding.
This commit is contained in:
52
Assets/_PROJECT/Components/SlideShow/SlideShow.cs
Normal file
52
Assets/_PROJECT/Components/SlideShow/SlideShow.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SlideShow : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> Slides; // Assign slide panels in the inspector
|
||||
public Button NextButton;
|
||||
public Button PreviousButton;
|
||||
private int currentSlideIndex = 0;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (Slides.Count == 0) return;
|
||||
UpdateSlideVisibility();
|
||||
|
||||
NextButton.onClick.AddListener(NextSlide);
|
||||
PreviousButton.onClick.AddListener(PreviousSlide);
|
||||
}
|
||||
|
||||
private void NextSlide()
|
||||
{
|
||||
if (currentSlideIndex < Slides.Count - 1)
|
||||
{
|
||||
currentSlideIndex++;
|
||||
UpdateSlideVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
private void PreviousSlide()
|
||||
{
|
||||
if (currentSlideIndex > 0)
|
||||
{
|
||||
currentSlideIndex--;
|
||||
UpdateSlideVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSlideVisibility()
|
||||
{
|
||||
for (int i = 0; i < Slides.Count; i++)
|
||||
{
|
||||
Slides[i].SetActive(i == currentSlideIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
NextButton.onClick.RemoveListener(NextSlide);
|
||||
PreviousButton.onClick.RemoveListener(PreviousSlide);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user