public override int Execute(LogicLevel level) { LogicGameObjectManager gameObjectManager = level.GetGameObjectManager(); LogicGameObject gameObject = gameObjectManager.GetGameObjectByID(this.m_gameObjectId); if (gameObject != null && gameObject.GetGameObjectType() == LogicGameObjectType.BUILDING) { LogicBuilding building = (LogicBuilding)gameObject; LogicVillage2UnitComponent village2UnitComponent = building.GetVillage2UnitComponent(); if (village2UnitComponent != null) { LogicClientAvatar playerAvatar = level.GetPlayerAvatar(); playerAvatar.CommodityCountChangeHelper(7, village2UnitComponent.GetUnitData(), -village2UnitComponent.GetUnitCount()); village2UnitComponent.RemoveUnits(); return(0); } } return(-1); }