Add OnStartup and OnTimer

This commit is contained in:
David Markowitz
2026-09-26 21:56:43 -07:00
parent 1c27c4957e
commit 59f74e2dd5
2 changed files with 16 additions and 2 deletions

View File

@@ -110,6 +110,7 @@ void Strip::HandleMsg(GameMessages::ResetModelToDefaults& msg) {
m_InActionRotation = NiPoint3Constant::ZERO; m_InActionRotation = NiPoint3Constant::ZERO;
m_RotationProgress = 0.0f; m_RotationProgress = 0.0f;
m_Speed = DEFAULT_SPEED; m_Speed = DEFAULT_SPEED;
m_PausedFromOnTimer = false;
} }
void Strip::OnChatMessageReceived(const std::string& sMessage) { void Strip::OnChatMessageReceived(const std::string& sMessage) {
@@ -399,13 +400,25 @@ void Strip::Update(float deltaTime, ModelComponent& modelComponent, UpdateResult
m_Speed = DEFAULT_SPEED; m_Speed = DEFAULT_SPEED;
if (nextAction.GetType() == "OnInteract") { if (nextAction.GetType() == "OnInteract") {
modelComponent.AddInteract(); modelComponent.AddInteract();
m_WaitingForAction = true;
} else if (nextAction.GetType() == "OnChat") { } else if (nextAction.GetType() == "OnChat") {
// logic here if needed m_WaitingForAction = true;
} else if (nextAction.GetType() == "OnAttack") { } else if (nextAction.GetType() == "OnAttack") {
modelComponent.AddAttack(); modelComponent.AddAttack();
m_WaitingForAction = true;
} else if (nextAction.GetType() == "OnStartup") {
IncrementAction();
} else if (nextAction.GetType() == "OnTimer") {
if (!m_PausedFromOnTimer) {
m_PausedTime = nextAction.GetValueParameterDouble();
m_PausedFromOnTimer = true;
} else {
IncrementAction();
m_PausedFromOnTimer = false;
}
} }
Game::entityManager->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
m_WaitingForAction = true;
} else { // should be a normal block } else { // should be a normal block
ProcNormalAction(deltaTime, modelComponent, updateResult); ProcNormalAction(deltaTime, modelComponent, updateResult);
} }

View File

@@ -55,6 +55,7 @@ private:
// The amount of time this strip is paused for. Any interactions with this strip should be bounced if this is greater than 0. // The amount of time this strip is paused for. Any interactions with this strip should be bounced if this is greater than 0.
// Actions that do not use time do not use this (ex. positions). // Actions that do not use time do not use this (ex. positions).
float m_PausedTime{ 0.0f }; float m_PausedTime{ 0.0f };
bool m_PausedFromOnTimer{ false };
// The index of the next action to be played. This should always be within range of [0, m_Actions.size()). // The index of the next action to be played. This should always be within range of [0, m_Actions.size()).
size_t m_NextActionIndex{ 0 }; size_t m_NextActionIndex{ 0 };