/** * @file Machine.cpp * @author sriram */ #include "pch.h" #include "Machine.h" #include "Component.h" /** * constructor * @param num */ Machine::Machine(const int num): mNumber(num) { } void Machine::Draw(std::shared_ptr graphics,double x, double y) { if (this!=nullptr) { for(auto component : mComponents) { component->Draw(graphics, x, y); } } } void Machine::AddComponent(std::shared_ptr component) { component->SetMachine(this); mComponents.push_back(component); } void Machine::ClearMachine() { mComponents.clear(); } void Machine::Update() { if (this!=nullptr) { for(auto component : mComponents) { component->SetTime(mTime); } } } void Machine::SetTime(double time) { mTime = time; Update(); }