public static bool IsWithInShopArea(SysBattleShopVo shopVo, Units player, out float distance) { bool result = false; distance = 0f; Vector3 a = Vector3.zero; float num = 0f; if (shopVo != null) { TeamType team = BattleEquipTools_config.ShopType2TeamType((EBattleShopType)shopVo.type); Transform spawnPos = MapManager.Instance.GetSpawnPos(team, shopVo.shop_origin); if (null != spawnPos) { a = spawnPos.position; num = (float)shopVo.shop_range; } } if (null != player) { Vector3 position = player.transform.position; distance = Vector3.Distance(a, position); result = (distance <= num); } return(result); }
public static bool WithinShopArea(ShopInfo shopInfo, Vector3 selfVect) { bool result = false; if (shopInfo != null) { Vector3 a = Vector3.zero; TeamType team = BattleEquipTools_config.ShopType2TeamType(shopInfo.ShopType); a = MapManager.Instance.GetSpawnPos(team, shopInfo.Config.shop_origin).position; float num = (float)shopInfo.Config.shop_range; result = (Vector3.Distance(a, selfVect) <= num); } return(result); }