열차 목업의 내부 확인용 프로젝트
smchoi
2024-07-24 ff74c0073046f0e086eb7d355950bda39937c92c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//////////////////////////////////////////////////////
// MK Glow Spectate Objects                         //
//                                                    //
// Created by Michael Kremmel                       //
// www.michaelkremmel.de                            //
// Copyright © 2017 All rights reserved.            //
//////////////////////////////////////////////////////
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
namespace MK.Glow.Example
{
    public class SpectateObjects : MonoBehaviour
    {
        [SerializeField]
        private GameObject[] _gameObjects = new GameObject[1];
        private int _currentObject = 0;
 
        public void SwitchObject()
        {
            _gameObjects[_currentObject++].SetActive(false);
            if(_currentObject > _gameObjects.Length - 1)
                _currentObject = 0;
            _gameObjects[_currentObject].SetActive(true);
        }
    }
}