-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeleteGameObject.cpp
More file actions
29 lines (23 loc) · 848 Bytes
/
DeleteGameObject.cpp
File metadata and controls
29 lines (23 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "DeleteGameObject.h"
#include"Grid.h"
DeleteGameObject::DeleteGameObject(ApplicationManager* pApp):Action(pApp) {}
void DeleteGameObject::ReadActionParameters() {
Grid* pGrid = pManager->GetGrid();
Output* pOut = pGrid->GetOutput();
Input* pIn = pGrid->GetInput();
pOut->PrintMessage("Delete Object: Click on its Cell ...");
positionOfObject = pIn->GetCellClicked();
pOut->ClearStatusBar();
if (!positionOfObject.IsValidCell()) {
pGrid->PrintErrorMessage("Opeartion Cancelled:invalid cell,click anywhere to continue");
}
pOut->ClearStatusBar();
}
void DeleteGameObject:: Execute(){
ReadActionParameters();
if (!positionOfObject.IsValidCell())
return;
Grid* pGrid = pManager->GetGrid();
pGrid->RemoveObjectFromCell(positionOfObject);
}
DeleteGameObject:: ~DeleteGameObject(){}