// Coroutine that waits for the atlas to be ready IEnumerator WaitForAtlas(OTSpriteAtlasCocos2D atlas) { yield return null; if (!atlas.isReady) { StartCoroutine(WaitForAtlas(atlas)); } }
void Awake() { // Init Gold coin size m_aniSpriteGoldCoin01 = GameObject.Find ("GoldCoin_01").GetComponent<OTAnimatingSprite>(); m_aniSpriteGoldCoin02 = GameObject.Find ("GoldCoin_02").GetComponent<OTAnimatingSprite>(); m_aniSpriteGoldCoin03 = GameObject.Find ("GoldCoin_03").GetComponent<OTAnimatingSprite>(); m_aniSpriteGoldCoin04 = GameObject.Find ("GoldCoin_04").GetComponent<OTAnimatingSprite>(); int l = 0; for (int i=0; i<13; i++) { string strAtlasName = ""; if (i < 9) { strAtlasName = "GoldCoin_Altas_0" + (i + 1); } else { strAtlasName = "GoldCoin_Altas_" + (i + 1); } int j = GameObject.Find (strAtlasName).GetComponent<OTSpriteAtlasCocos2D>().atlasData.Length; for (int k=0; k<j; k++) { m_sizeOfGoldCoin[l] = GameObject.Find (strAtlasName).GetComponent<OTSpriteAtlasCocos2D>().atlasData[k].size; l++; } } // Init Gold coin position float[] XposCoin = new float[30] { 370.0f,369.0f,353.0f,343.0f,342.0f,347.0f,330.0f,325.0f,315.0f,269.0f, 274.0f,266.0f,277.0f,198.0f,230.0f,160.0f,184.0f,222.0f,183.0f,124.0f, 120.0f,166.0f,122.0f,87.0f,51.0f,56.0f,153.0f,149.0f,99.0f,267.0f }; float[] YposCoin = new float[30] { 0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f, 0.0f,37.0f,51.0f,27.0f,62.0f,46.0f,146.0f,167.0f,179.0f,218.0f,336.0f, 345.0f,438.0f,476.0f,459.0f,491.0f }; for(int i=0; i<30; i++) { m_posGoldCoin[i] = new Vector2(0.0f, (YposCoin[i] * -1.0f) + (-140.0f)); } // Hide the animation m_aniSpriteGoldCoin01.alpha = 0f; m_aniSpriteGoldCoin02.alpha = 0f; m_aniSpriteGoldCoin03.alpha = 0f; m_aniSpriteGoldCoin04.alpha = 0f; // Get Sprite Container m_spriteContainerGoldCoin = GameObject.Find ("GoldCoin_Altas_01").GetComponent<OTSpriteAtlasCocos2D>(); // Init elapsed time m_fElapsedTime = 0f; // Init State m_state = STATE.DISP_NONE; }
private void getAtlas() { //Obtengo el atlas de imagenes GameObject[] anim = GameObject.FindGameObjectsWithTag("cardContainer"); this.atlas = (OTSpriteAtlasCocos2D)anim[0].GetComponent(typeof(OTSpriteAtlasCocos2D)); }