void Start() { ani = transform.GetChild(0).GetComponent <Animator>(); aniStat = AniStat.NotStarted; //TargetScale = GetComponent<RectTransform>().localScale; GetComponent <RectTransform>().localScale = new Vector3(0, 0, 0); }
///<summary> ///Close this pop up window ///</summary> public void Close() { aniStat = AniStat.Closing; if (isInGame) { GameObject.Find("Canvas/AntiOverFlow/Finger").GetComponent <BoxCollider2D>().enabled = true; } }
void Ani() { switch (aniStat) { case AniStat.NotStarted: aniStat = AniStat.Starting; break; case AniStat.Starting: ani.Play("pop up"); break; case AniStat.Closing: ani.Play("pop down"); if (ani.gameObject.GetComponent <RectTransform>().localScale.x <= 0) { Destroy(gameObject); } break; } }