public void CheckWall(LogicVector2 position) { if (this.m_parent != null) { LogicGameObject gameObject = this.m_parent.GetParent(); LogicTile tile = gameObject.GetLevel().GetTileMap().GetTile(position.m_x >> 9, position.m_y >> 9); if (tile != null) { for (int i = 0; i < tile.GetGameObjectCount(); i++) { LogicGameObject go = tile.GetGameObject(i); if (go.IsWall() && go.IsAlive()) { this.m_wall = go; if (((LogicBuilding)go).GetHitWallDelay() <= 0) { ++this.m_wallCount; } } } } } }
public bool TileOkForSpawn(LogicTile tile) { if (tile != null && !tile.IsFullyNotPassable()) { for (int i = 0; i < tile.GetGameObjectCount(); i++) { LogicGameObjectType gameObjectType = tile.GetGameObject(i).GetGameObjectType(); if (gameObjectType == LogicGameObjectType.BUILDING || gameObjectType == LogicGameObjectType.OBSTACLE || gameObjectType == LogicGameObjectType.TRAP || gameObjectType == LogicGameObjectType.DECO) { return(false); } } return(true); } return(false); }
public void SetPosition(int x, int y) { if (this.m_parent != null) { if (!this.m_parent.IsFlying() && !this.m_parent.IsUnderground() && this.m_parent.GetJump() <= 0 && !this.m_ignorePush) { this.ValidatePos(); if (this.m_position.m_x >> 8 == x >> 8) { if ((this.m_position.m_y ^ (uint)y) < 256) { goto set; } } LogicTileMap tileMap = this.m_parent.GetParent().GetLevel().GetTileMap(); int pathFinderX = x >> 8; int pathFinderY = y >> 8; if (!tileMap.IsPassablePathFinder(pathFinderX, pathFinderY)) { LogicTile tile = tileMap.GetTile(pathFinderX / 2, pathFinderY / 2); if (LogicDataTables.GetGlobals().JumpWhenHitJumpable()) { bool allowJump = false; for (int i = 0; i < tile.GetGameObjectCount(); i++) { LogicGameObject gameObject = tile.GetGameObject(i); if (gameObject.GetGameObjectType() == LogicGameObjectType.BUILDING) { LogicBuilding building = (LogicBuilding)gameObject; if (building.GetHitWallDelay() > 0) { allowJump = true; } } } if (allowJump) { this.m_position.m_x = x; this.m_position.m_y = y; this.m_parent.EnableJump(128); return; } } if (LogicDataTables.GetGlobals().SlideAlongObstacles()) { throw new NotImplementedException(); // TODO: Implement this. } else { x = LogicMath.Clamp(x, (int)(this.m_position.m_x & 0xFFFFFF00), this.m_position.m_x | 0xFF); y = LogicMath.Clamp(y, (int)(this.m_position.m_y & 0xFFFFFF00), this.m_position.m_y | 0xFF); } this.m_position.m_x = x; this.m_position.m_y = y; this.ValidatePos(); return; } } } set: this.m_position.m_x = x; this.m_position.m_y = y; }