/// <summary> /// Initializes the tile with new data. /// </summary> /// <param name="diamonds">Number of diamonds in the tile.</param> /// <param name="xCoord">x-position in the grid for the tile.</param> /// <param name="yCoord">y-position in the grid for the tile.</param> /// <param name="inLevel">Reference to the level the tile is in.</param> public void Initialize(int diamonds, int xCoord, int yCoord, LevelScript inLevel) { // Attach hint FX var hintP = ObjectPooler.Instance.GetPooledObject(hintParticles.name); hintP.transform.SetParent(transform); hintP.transform.localPosition = new Vector3(0, fxOffset, 0); hintP.SetActive(true); hintFX = hintP.GetComponent <ParticleSystem>(); // Attach explosion FX var explodeP = ObjectPooler.Instance.GetPooledObject(explodedParticles.name); explodeP.transform.SetParent(transform); explodeP.transform.localPosition = new Vector3(0, fxOffset, 0); explodeP.SetActive(true); explodeFX = explodeP.GetComponent <ChildParticleEmitter>(); // Update variables numDiamonds = diamonds; clickable = true; x = xCoord; y = yCoord; level = inLevel; }
/// <summary> /// Initializes the tile with new data. /// </summary> /// <param name="diamonds">Number of diamonds in the tile.</param> /// <param name="xCoord">x-position in the grid for the tile.</param> /// <param name="yCoord">y-position in the grid for the tile.</param> /// <param name="inLevel">Reference to the level the tile is in.</param> public void Initialize(int diamonds, int xCoord, int yCoord, LevelScript inLevel) { // Attach hint FX var hintP = ObjectPooler.Instance.GetPooledObject(hintParticles.name); hintP.transform.SetParent(transform); hintP.transform.localPosition = new Vector3(0, fxOffset, 0); hintP.SetActive(true); hintFX = hintP.GetComponent<ParticleSystem>(); // Attach explosion FX var explodeP = ObjectPooler.Instance.GetPooledObject(explodedParticles.name); explodeP.transform.SetParent(transform); explodeP.transform.localPosition = new Vector3(0, fxOffset, 0); explodeP.SetActive(true); explodeFX = explodeP.GetComponent<ChildParticleEmitter>(); // Update variables numDiamonds = diamonds; clickable = true; x = xCoord; y = yCoord; level = inLevel; }