public IsOutOfBounds ( FSO.LotView.Model.LotTilePos pos ) : bool | ||
pos | FSO.LotView.Model.LotTilePos | |
리턴 | bool |
public VMPlacementResult PositionValid(LotTilePos pos,Direction direction,VMContext context) { if (pos == LotTilePos.OUT_OF_WORLD) { return(new VMPlacementResult()); } else if (context.IsOutOfBounds(pos)) { return new VMPlacementResult { Status = VMPlacementError.LocationOutOfBounds } } ; //TODO: speedup with exit early checks //TODO: corner checks (wtf uses this) var arch = context.Architecture; var wall = arch.GetWall(pos.TileX,pos.TileY,pos.Level); //todo: preprocess to check which walls are real solid walls and not fences. if (this is VMGameObject) //needs special handling for avatar eventually { VMPlacementError wallValid = WallChangeValid(wall,direction,true); if (wallValid != VMPlacementError.Success) { return new VMPlacementResult { Status = wallValid } } ; } var floor = arch.GetFloor(pos.TileX,pos.TileY,pos.Level); VMPlacementError floorValid = FloorChangeValid(floor,pos.Level); if (floorValid != VMPlacementError.Success) { return new VMPlacementResult { Status = floorValid } } ; //we've passed the wall test, now check if we intersect any objects. var valid = (this is VMAvatar)? context.GetAvatarPlace(this,pos,direction) : context.GetObjPlace(this,pos,direction); return(valid); }
public VMPlacementResult PositionValid(LotTilePos pos, Direction direction, VMContext context) { if (pos == LotTilePos.OUT_OF_WORLD) return new VMPlacementResult(); else if (context.IsOutOfBounds(pos)) return new VMPlacementResult { Status = VMPlacementError.LocationOutOfBounds }; //TODO: speedup with exit early checks //TODO: corner checks (wtf uses this) var arch = context.Architecture; var wall = arch.GetWall(pos.TileX, pos.TileY, pos.Level); //todo: preprocess to check which walls are real solid walls and not fences. if (this is VMGameObject) //needs special handling for avatar eventually { VMPlacementError wallValid = WallChangeValid(wall, direction, true); if (wallValid != VMPlacementError.Success) return new VMPlacementResult { Status = wallValid }; } var floor = arch.GetFloor(pos.TileX, pos.TileY, pos.Level); VMPlacementError floorValid = FloorChangeValid(floor, pos.Level); if (floorValid != VMPlacementError.Success) return new VMPlacementResult { Status = floorValid }; //we've passed the wall test, now check if we intersect any objects. var valid = (this is VMAvatar)? context.GetAvatarPlace(this, pos, direction) : context.GetObjPlace(this, pos, direction); return valid; }