void DoAnim(BackgroundPlaneAnim activeBack, bool withAlpha = true) { Action<BackgroundPlaneAnim> onAnimFinish = (bp) => { bp.FadeOut(); this.SwapBacksPositions(); this.SetNextTextureIndex(); BackgroundPlaneAnim newBp = this.GetNextActiveBack(bp); this.DoAnim(newBp); }; activeBack.SetTexture(this._textures[this._currentTextureIndex]); activeBack.DoAnim(withAlpha, onAnimFinish); }
BackgroundPlaneAnim GetNextActiveBack(BackgroundPlaneAnim bp) { return bp == this.back1 ? this.back2 : this.back1; }