/// <summary> /// Returns light to the pool after it has reached the end of the waypoints. /// </summary> /// <param name="light"> Light that should be placed back to the pool </param> public void ReturnLightToPool(KanteleHeroLight light) { if (!_kanteleLights.ReturnObject(light)) { Debug.LogError("Could not return light back to the pool! "); } }
/// <summary> /// Spawns light on the panel that start moving towards the end of the rail /// </summary> /// <param name="waypoints"> Waypoints for the correct side </param> /// <param name="side"> Decide which side the light moves on the panel </param> private void SpawnLight(GameObject[] waypoints, LightSide side, int noteNumber) { KanteleHeroLight light = _kanteleLights.GetPooledObject(); if (light != null) { if (side == LightSide.left) { light.Init(waypoints, this, _lightMoveSpeed, side, noteNumber); light.GetComponent <Renderer>().material = LeftLightMaterial; } else { light.Init(waypoints, this, _lightMoveSpeed, side, noteNumber); light.GetComponent <Renderer>().material = RightLightMaterial; } } }