UNITY/크레이지아케이드 모작

크아 모작 프로젝트 시작

2zreal 2024. 6. 26. 16:30

크레이지 아케이드 모작 프로젝트를 시작했다.

 

일단 기초적인 버튼 작업이랑 리소스부터 구해놨다.

 

처음에는 

 

이렇게 넥슨 표시가 뜨게 만들었다.

 

using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class StartScript : MonoBehaviour
{
    public Image displayImage; 
    public string imageFolderPath = "Nexon";
    public Sprite[] images; 
    public float interval = 0.2f;
    public GameObject startpanel;

    private int currentIndex = 0;

    void Start()
    {
        LoadImagesFromFolder();
        if (images.Length > 0)
        {
            StartCoroutine(Slideshow());
        }
    }

    void LoadImagesFromFolder()
    {
        images = Resources.LoadAll<Sprite>(imageFolderPath);   
    }

    IEnumerator Slideshow()
    {
        while (true)
        {
            displayImage.sprite = images[currentIndex];
            currentIndex = (currentIndex + 1) % images.Length;
            yield return new WaitForSeconds(interval);

            if (currentIndex==92)
            {
                displayImage.gameObject.SetActive(false);
                startpanel.SetActive(true);
            }
        }
    }
}

리소스 폴더 안에 있는 넥슨에 이미지를 모두 불러들인 뒤 0.2초마다 이미지를 읽는 것이다.(0.2초 말고 0.15초로 하니까 더 자연스러웠음.)

오늘은 간단하게 이정도만 하였다.

 

이 프로젝트에서는 기본적인 게임 로직을 구현하고 파이어베이스, 포톤을 이용해서 멀티를 구현할 예정이다.(조금 바뀔 수도 있음.)