using System.Linq; using UnityEngine; public static class GameObjectExtensions { public static BattleCardBase GetBattleCard(this GameObject go) { if (go == null) { return null; } BattleCardBase battleCardBase = null; BattleCardBase battleCardBase2 = null; battleCardBase = BattleManagerBase.GetIns().BattlePlayer.AllCards.FirstOrDefault((BattleCardBase s) => s.BattleCardView.GameObject == go); battleCardBase2 = BattleManagerBase.GetIns().BattleEnemy.AllCards.FirstOrDefault((BattleCardBase s) => s.BattleCardView.GameObject == go); if (battleCardBase != null) { return battleCardBase; } return battleCardBase2; } }