public int GetMarkedBySelfCount(BaseUnit owner, TTarget target) { if (owner == null) { return(0); } if (target == null) { return(0); } if (!target.IsLive) { return(0); } if (!TargetUnits.ContainsKey(target)) { return(0); } bool ret = Targets.Contains(target); int count = 0; if (ret) { foreach (var item in TargetUnits[target]) { if (!item.IsLive) { continue; } if (owner.IsSelf(owner)) { count++; } } } return(count); }
public bool IsMarkedBySelf(BaseUnit owner, TTarget target) { if (owner == null) { return(false); } if (target == null) { return(false); } if (!target.IsLive) { return(false); } if (!TargetUnits.ContainsKey(target)) { return(false); } bool ret = Targets.Contains(target); if (ret) { foreach (var item in TargetUnits[target]) { if (!item.IsLive) { continue; } if (owner.IsSelf(owner)) { return(true); } } return(false); } return(false); }