-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix physics interpolation. Implement new power up types
- Loading branch information
1 parent
d9c198a
commit 89ac3b7
Showing
29 changed files
with
404 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
namespace linguine { | ||
|
||
struct Boost { | ||
float magnitude = 0.0f; | ||
float duration = 1.0f; | ||
float elapsed = 0.0f; | ||
}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace linguine { | ||
|
||
struct TimeWarp { | ||
TimeWarp(float factor, float duration) | ||
: factor(factor), duration(duration) {} | ||
|
||
const float factor = 1.0f; | ||
const float duration = 1.0f; | ||
float elapsed = 0.0f; | ||
}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "Revive.h" | ||
|
||
#include <glm/common.hpp> | ||
|
||
#include "components/Alive.h" | ||
#include "components/Health.h" | ||
|
||
namespace linguine { | ||
|
||
void Revive::execute(linguine::Entity& target) { | ||
auto dead = std::vector<uint64_t>(); | ||
|
||
_entityManager.find<Health>()->each([&dead](const Entity& entity) { | ||
if (!entity.has<Alive>()) { | ||
dead.push_back(entity.getId()); | ||
} | ||
}); | ||
|
||
if (!dead.empty()) { | ||
auto randomEntity = std::uniform_int_distribution(0, static_cast<int>(dead.size() - 1)); | ||
auto i = randomEntity(_random); | ||
|
||
auto entity = _entityManager.getById(dead[i]); | ||
auto health = entity->get<Health>(); | ||
health->current = static_cast<int32_t>(glm::round(static_cast<float>(health->max) * 0.25f)); | ||
entity->add<Alive>(); | ||
} | ||
} | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include "Action.h" | ||
|
||
#include <random> | ||
|
||
namespace linguine { | ||
|
||
class Revive : public Action { | ||
public: | ||
explicit Revive(EntityManager& entityManager) | ||
: _entityManager(entityManager) {} | ||
|
||
~Revive() override = default; | ||
|
||
void execute(Entity& target) override; | ||
|
||
private: | ||
std::random_device _random; | ||
EntityManager& _entityManager; | ||
}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.