Computer Language/유니티
stack의 활용예 gameobject와 연결해서 사용이 가능하다
알 수 없는 사용자
2014. 5. 19. 17:48
using UnityEngine;
using System.Collections;
public class Chap10_8 : MonoBehaviour {
public GameObject[] cubes;
Stack stack = new Stack();
// Use this for initialization
void Start () {
for(int i = 0; i < 5; i++)
stack.Push(cubes[i]);
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.Space)){
Destroy(stack.Pop() as GameObject);
}
}
}