using System; using System.Collections.Generic; using UnityEngine; namespace RenderHeads.Media.AVProVideo.Demos { public class Mapping3D : MonoBehaviour { private void Update() { this._timer -= Time.deltaTime; if (this._timer <= 0f) { this._timer = 0.25f; this.SpawnCube(); if (this._cubes.Count > 48) { this.RemoveCube(); } } } private void SpawnCube() { Quaternion rotation = Quaternion.Euler(UnityEngine.Random.Range(-180f, 180f), UnityEngine.Random.Range(-180f, 180f), UnityEngine.Random.Range(-180f, 180f)); float num = UnityEngine.Random.Range(0.1f, 0.6f); GameObject gameObject = UnityEngine.Object.Instantiate(this._cubePrefab, base.transform.position, rotation); Transform component = gameObject.GetComponent(); component.localScale = new Vector3(num, num, num); this._cubes.Add(gameObject); } private void RemoveCube() { GameObject obj = this._cubes[0]; this._cubes.RemoveAt(0); UnityEngine.Object.Destroy(obj); } public GameObject _cubePrefab; private const int MaxCubes = 48; private const float SpawnTime = 0.25f; private float _timer = 0.25f; private List _cubes = new List(32); } }