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 HasWall() { for (int i = 0; i < this.m_gameObjects.Size(); i++) { LogicGameObject gameObject = this.m_gameObjects[i]; if (gameObject.IsWall() && gameObject.IsAlive()) { return(true); } } return(false); }
public void WallRemoved() { LogicArrayList <LogicComponent> components = this.m_parent.GetComponentManager().GetComponents(LogicComponentType.MOVEMENT); for (int i = 0; i < components.Size(); i++) { LogicCombatComponent combatComponent = components[i].GetParent().GetCombatComponent(); if (combatComponent != null && combatComponent.GetTarget(0) != null) { LogicGameObject target = combatComponent.GetTarget(0); if (target.IsWall()) { combatComponent.ForceNewTarget(); } } } }
/// <summary> /// Executes this instance. /// </summary> public override int Execute(LogicLevel level) { if (LogicDataTables.GetGlobals().UseSwapBuildings()) { if (this._gameObject1 != this._gameObject2) { LogicGameObject gameObject1 = level.GetGameObjectManager().GetGameObjectByID(this._gameObject1); LogicGameObject gameObject2 = level.GetGameObjectManager().GetGameObjectByID(this._gameObject2); if (gameObject1 != null) { if (gameObject2 != null) { int gameObjectType1 = gameObject1.GetGameObjectType(); if (gameObjectType1 <= 6) { if (gameObjectType1 == 0 || gameObjectType1 == 4 || gameObjectType1 == 6) { int gameObjectType2 = gameObject2.GetGameObjectType(); if (gameObjectType2 <= 6) { if (gameObjectType2 == 0 || gameObjectType2 == 4 || gameObjectType2 == 6) { int width1 = gameObject1.GetWidthInTiles(); int width2 = gameObject2.GetWidthInTiles(); int height1 = gameObject1.GetHeightInTiles(); int height2 = gameObject2.GetHeightInTiles(); if (width1 == width2 && height1 == height2) { if (gameObject1.GetGameObjectType() == 0) { if (((LogicBuilding)gameObject1).IsLocked()) { return(-6); } if (gameObject1.IsWall()) { return(-7); } } if (gameObject2.GetGameObjectType() == 0) { if (((LogicBuilding)gameObject2).IsLocked()) { return(-8); } if (gameObject2.IsWall()) { return(-9); } } int x1 = gameObject1.GetX(); int y1 = gameObject1.GetY(); int x2 = gameObject2.GetX(); int y2 = gameObject2.GetY(); gameObject1.SetPositionXY(x2, y2); gameObject2.SetPositionXY(x1, y1); return(0); } return(-5); } } return(-4); } } return(-3); } return(-2); } return(-1); } return(-98); } return(-99); }