FSO.SimAntics.VMContext.IsOutOfBounds C# (CSharp) Method

IsOutOfBounds() public method

public IsOutOfBounds ( FSO.LotView.Model.LotTilePos pos ) : bool
pos FSO.LotView.Model.LotTilePos
return bool
        public bool IsOutOfBounds(LotTilePos pos)
        {
            return (pos.x < 0 || pos.y < 0 || pos.Level < 1 || pos.TileX >= _Arch.Width || pos.TileY >= _Arch.Height || pos.Level > _Arch.Stories);
        }

Usage Example

Ejemplo n.º 1
0
        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);
        }
All Usage Examples Of FSO.SimAntics.VMContext::IsOutOfBounds