/// <summary> /// 移除单位 /// </summary> /// <returns><c>true</c>, if unit was removed, <c>false</c> otherwise.</returns> /// <param name="unit">Unit.</param> public bool RemoveUnit(IAStarUnit unit) { int index = this.units.IndexOf(unit); if (index != -1) { //unit.RemoveIsPassableChange(this.IsPassableChange); this.units.RemoveAt(index); this.RefreshPassCost(); return(true); } return(false); }
/// <summary> /// 移除单位 /// </summary> /// <returns><c>true</c>, if unit was removed, <c>false</c> otherwise.</returns> /// <param name="unit">Unit.</param> public bool RemoveUnit(IAStarUnit unit) { var index = _units.IndexOf(unit); if (index == -1) { return(false); } //unit.RemoveIsPassableChange(this.IsPassableChange); _units.RemoveAt(index); RefreshPassCost(); return(true); }
/// <summary> /// 单位的 isPassable 属性被改变 /// </summary> /// <returns><c>true</c> if this instance is passable change; otherwise, <c>false</c>.</returns> /*private void IsPassableChange() * { * this.RefreshPassCost(); * }*/ /// <summary> /// 添加单位 /// </summary> /// <returns><c>true</c>, if unit was added, <c>false</c> otherwise.</returns> /// <param name="unit">Unit.</param> public bool AddUnit(IAStarUnit unit) { if (this.walkable) { if (this.units.IndexOf(unit) == -1) { //unit.AddIsPassableChange(this.IsPassableChange); this.units.Add(unit); RefreshPassCost(); return(true); } } return(false); }
/// <summary> /// 单位的 IsPassable 属性被改变 /// </summary> /// <returns><c>true</c> if this instance is passable change; otherwise, <c>false</c>.</returns> /*private void IsPassableChange() * { * this.RefreshPassCost(); * }*/ /// <summary> /// 添加单位 /// </summary> /// <returns><c>true</c>, if unit was added, <c>false</c> otherwise.</returns> /// <param name="unit">Unit.</param> public bool AddUnit(IAStarUnit unit) { if (!Walkable) { return(false); } if (_units.IndexOf(unit) != -1) { return(false); } //unit.AddIsPassableChange(this.IsPassableChange); _units.Add(unit); RefreshPassCost(); return(true); }
/// <summary> /// 移除单位 /// </summary> /// <returns><c>true</c>, if unit was removed, <c>false</c> otherwise.</returns> /// <param name="unit">Unit.</param> public bool RemoveUnit(IAStarUnit unit) { int index = this.units.IndexOf(unit); if(index != -1) { //unit.RemoveIsPassableChange(this.IsPassableChange); this.units.RemoveAt(index); this.RefreshPassCost(); return true; } return false; }
/// <summary> /// 单位的 isPassable 属性被改变 /// </summary> /// <returns><c>true</c> if this instance is passable change; otherwise, <c>false</c>.</returns> /*private void IsPassableChange() { this.RefreshPassCost(); }*/ /// <summary> /// 添加单位 /// </summary> /// <returns><c>true</c>, if unit was added, <c>false</c> otherwise.</returns> /// <param name="unit">Unit.</param> public bool AddUnit(IAStarUnit unit) { if(this.walkable) { if(this.units.IndexOf(unit) == -1) { //unit.AddIsPassableChange(this.IsPassableChange); this.units.Add(unit); RefreshPassCost(); return true; } } return false; }