public void Start() { objectPooler = ObjectPooler.SharedInstance; floorGlobal = FloorGlobal.Instance; floorGlobal.pausableScripts.Add(this); floorGlobal.onBeat.AddListener(OnBeat); audioSource = GetComponent <AudioSource>(); playerController = transform.parent.parent.GetComponent <PlayerController>(); Bullet bullet = bulletPrefab.GetComponent <Bullet>(); bullet.bulletDestroyedEffectIndex = objectPooler.AddObject(bullet.bulletDestroyedEffect, 20, true); bulletIndex = objectPooler.AddObject(bulletPrefab, 20, true); }
private void Start() { _op = ObjectPooler.sharedInstance; differentIndex = _op.AddObject(prefabCoins, countCoins); Random.InitState((int)System.DateTime.Now.Ticks); StartCoroutine(SpawnMeteor()); StartCoroutine(SpawnCoins()); }
protected override void Awake() { base.Awake(); floorGlobal = FloorGlobal.Instance; floorGlobal.bpmVisualiser = this; audioSource = Camera.main.GetComponent <AudioSource>(); baseBPM = BPMDetector.AnalyzeBpm(audioSource.clip); objectPooler = ObjectPooler.SharedInstance; Debug.Log(objectPooler.name); //prevents superfast creation while (baseBPM > 180) { baseBPM /= 2; } currBPM = baseBPM; timeUntilNextBeat = 60f / currBPM; //baseTimeUntilNextBeat = timeUntilNextBeat; //calculates time before new beat tick is spawned //beatCreateTime = 1 / (baseBPM / 60); minBPM = Mathf.Max(10, baseBPM - 60); maxBPM = Mathf.Min(240, baseBPM + 60); beatIndicator.transform.localScale = new Vector3(1, 1, 1); beatIndicatorMovement = beatIndicator.GetComponent <BeatIndicatorMovement>(); beatIndicatorMovement.beatTime = timeUntilNextBeat; beatIndicatorMovement.beatMarker = transform; beatIndicatorMovement.audioSource = audioSource; beatCount = beatValues.Count; beatIndicatorIndex = objectPooler.AddObject(beatIndicator, 4); //startHangTime = timeUntilNextBeat - beatHangTime; inputOffset = ES3.Load("inputOffset", 0f); //StartCoroutine(BeatHangDelay()); floorGlobal.pausableScripts.Add(this); isPlaying = false; StartCoroutine(StartMusic()); }
private void AddGameObjectToObjectPooler(GameObject go) { // add the gameobject to the correct ObjectPooler switch (go.tag) { case EmptyCellTag: emptyCellObjectPooler.AddObject(go); break; case TreeCellTag: treeCellObjectPooler.AddObject(go); break; case BurningCellTag: burningCellObjectPooler.AddObject(go); break; default: Debug.LogWarning("failed to add gameobject to pool, unknown tag found : " + go.tag); break; } }
private void Start() { // Init objects to pool objectPooler = ObjectPooler.SharedInstance; poIndex = objectPooler.AddObject(spawnable, 1, true); }
private void Start() { OP = ObjectPooler.SharedInstance; differentIndex = OP.AddObject(differentBall); Random.InitState((int)System.DateTime.Now.Ticks); }
// Start is called before the first frame update #region Unity Callbacks void Start() { objectPooler = ObjectPooler.SharedInstance; poIndex = objectPooler.AddObject(hitFX, 1, true); audioSource = GetComponent <AudioSource>(); }