Я пересоздал репозиторий из-за большого количества мусора в прошлом
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#include "TestWorld.h"
|
||||
|
||||
#include "Game/GameInstance.h"
|
||||
#include "Game/SaveMap/SaveMap.h"
|
||||
#include "Log/Log.h"
|
||||
|
||||
TestWorld::TestWorld(GameInstance& game_instance) : World(game_instance)
|
||||
{}
|
||||
|
||||
void TestWorld::BeginPlay()
|
||||
{
|
||||
World::BeginPlay();
|
||||
Log("TestWorld::BeginPlay");
|
||||
}
|
||||
|
||||
void TestWorld::Tick(double delta_time)
|
||||
{
|
||||
World::Tick(delta_time);
|
||||
|
||||
time += delta_time;
|
||||
if (time >= 10.0)
|
||||
{
|
||||
Message("TestWorld: Time out");
|
||||
GetGameInstance().quit();
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<SaveMap> TestWorld::save()
|
||||
{
|
||||
std::shared_ptr<SaveMap> save = World::save();
|
||||
std::shared_ptr<SaveMap> my_save = std::make_shared<SaveMap>("TestWorld");
|
||||
my_save->SaveDouble("time", time)->connect_to(save);
|
||||
return my_save;
|
||||
}
|
||||
|
||||
void TestWorld::load(std::shared_ptr<SaveMap> save)
|
||||
{
|
||||
World::load(save->getParent());
|
||||
time = save->GetDouble("time");
|
||||
}
|
||||
Reference in New Issue
Block a user