diff --git a/Assets/Scripts/Gui/engineerCommands.lua b/Assets/Scripts/Gui/engineerCommands.lua index 4920789..f7c8afd 100644 --- a/Assets/Scripts/Gui/engineerCommands.lua +++ b/Assets/Scripts/Gui/engineerCommands.lua @@ -1,15 +1,56 @@ -numGui = 1 +numGui = 5 res = graphics.resolution +Size = {x = 100, y = 100} gui = { { pos = {x = res.x - 200, y = res.y - 200}, + size = Size, + name = 'Land factory', + imagePath = '', + guiType = GuiType.BUTTON, + buttonType = ButtonType.BUILD, + trigger = 75, + structureId = 8 + }, + { + pos = {x = res.x - Size.x - 200, y = res.y - 200}, + size = Size, + name = 'Naval factory', + imagePath = '', + guiType = GuiType.BUTTON, + buttonType = ButtonType.BUILD, + trigger = 78, + structureId = 9 + }, + { + pos = {x = res.x - 2 * Size.x - 200, y = res.y - 200}, size = {x = 100, y = 100}, + name = 'Market', + imagePath = '', + guiType = GuiType.BUTTON, + buttonType = ButtonType.BUILD, + trigger = 75, + structureId = 10 + }, + { + pos = {x = res.x - 3 * Size.x - 200, y = res.y - 200}, + size = Size, + name = 'Lab', + imagePath = '', + guiType = GuiType.BUTTON, + buttonType = ButtonType.BUILD, + trigger = 84, + structureId = 11 + }, + { + pos = {x = res.x - 4 * Size.x - 200, y = res.y - 200}, + size = Size, name = 'Point defense', imagePath = '', guiType = GuiType.BUTTON, buttonType = ButtonType.BUILD, - trigger = 66, - structureId = 8 + trigger = 80, + structureId = 12 } } diff --git a/activeGameState.cpp b/activeGameState.cpp index 0594ae9..95e95a8 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -22,6 +22,7 @@ #include "util.h" #include "tooltip.h" #include "gameObjectFrameController.h" +#include "gameObjectFactory.h" #include "cameraController.h" #include "concreteGuiManager.h" @@ -350,6 +351,12 @@ namespace battleship{ } else if(ufCtr->isPlacingFrames() && !selectingDestOrient){ castRayToTerrain(); + + GameObjectFrame gmObjFr = ufCtr->getGameObjectFrame(0); + Unit *buildStruct = GameObjectFactory::createUnit(mainPlayer, gmObjFr.getId(), gmObjFr.getPos(), gmObjFr.getRot()); + mainPlayer->addUnit(buildStruct); + targets[0].unit = buildStruct; + issueOrder(Order::TYPE::BUILD, targets, shiftPressed); } else if(canSelect){