// public bool unitUnRegister(RTSGameUnit unit) { if (unit == null || GameUnitsDic == null) { return(false); } if (GameUnitsDic.ContainsKey(unit.gameUnitBelongSide)) { List <RTSGameUnit> unitsList = GameUnitsDic[unit.gameUnitBelongSide]; lock (unitsList) { unitsList.Remove(unit); } } return(true); }
// public bool unitRegister(RTSGameUnit unit) { if (unit == null || GameUnitsDic == null) { return(false); } if (!GameUnitsDic.ContainsKey(unit.gameUnitBelongSide)) { GameUnitsDic.Add(unit.gameUnitBelongSide, new List <RTSGameUnit>()); } List <RTSGameUnit> unitsList = GameUnitsDic[unit.gameUnitBelongSide]; lock (unitsList) { unitsList.Add(unit); } return(true); }