public void Animate(float duration, TileAnimator.AnimationEvent callback) { TileAnimator anim = gameObject.AddComponent <TileAnimator> (); anim.duration = duration; anim.ti = this; anim.OnAnimationEnd += callback; anim.Play(); }
void ShowTile(TileInfo ti) { ti.renderer.enabled = true; if (!ti.hasAnimated) { if (ti.zoomLevel == TILE_MIN_ZOOM_LEVEL) { ti.hasAnimated = true; ti.animationFinished = true; ti.renderer.sharedMaterial = ti.parent.normalMat; } else if (ti.zoomLevel > TILE_MIN_ZOOM_LEVEL) { ti.hasAnimated = true; TileAnimator anim = ti.gameObject.AddComponent <TileAnimator> (); anim.duration = 1f; anim.ti = ti; } } }