Removes CountdownNodeable.cpp/h from Gems/ScriptCanvas
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>monroegm-disable-blank-issue-2
parent
0b8859b246
commit
d9dbd439d4
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CountdownNodeable.h"
|
||||
#include <ScriptCanvas/Utils/SerializationUtils.h>
|
||||
#include <ScriptCanvas/Utils/VersionConverters.h>
|
||||
|
||||
namespace ScriptCanvas
|
||||
{
|
||||
namespace Nodeables
|
||||
{
|
||||
namespace Time
|
||||
{
|
||||
CountdownNodeable::~CountdownNodeable()
|
||||
{
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void CountdownNodeable::InitiateCountdown(bool reset, float countdownSeconds, bool looping, float holdTime)
|
||||
{
|
||||
if (reset || !AZ::TickBus::Handler::BusIsConnected())
|
||||
{
|
||||
// If we're resetting, we need to disconnect.
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
|
||||
m_countdownSeconds = countdownSeconds;
|
||||
m_looping = looping;
|
||||
m_holdTime = holdTime;
|
||||
|
||||
m_currentTime = m_countdownSeconds;
|
||||
|
||||
AZ::TickBus::Handler::BusConnect();
|
||||
}
|
||||
}
|
||||
|
||||
void CountdownNodeable::OnDeactivate()
|
||||
{
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void CountdownNodeable::OnTick(float deltaTime, AZ::ScriptTimePoint time)
|
||||
{
|
||||
if (m_currentTime <= 0.f)
|
||||
{
|
||||
if (m_holding)
|
||||
{
|
||||
m_holding = false;
|
||||
m_currentTime = m_countdownSeconds;
|
||||
m_elapsedTime = 0.f;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_looping)
|
||||
{
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_holding = m_holdTime > 0.f;
|
||||
m_currentTime = m_holding ? m_holdTime : m_countdownSeconds;
|
||||
}
|
||||
|
||||
ExecutionOut(AZ_CRC("Done", 0x102de0ab), m_elapsedTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentTime -= static_cast<float>(deltaTime);
|
||||
m_elapsedTime = m_holding ? 0.f : m_countdownSeconds - m_currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
void CountdownNodeable::Reset(float countdownSeconds, Data::BooleanType looping, float holdTime)
|
||||
{
|
||||
InitiateCountdown(true, countdownSeconds, looping, holdTime);
|
||||
}
|
||||
|
||||
void CountdownNodeable::Start(float countdownSeconds, Data::BooleanType looping, float holdTime)
|
||||
{
|
||||
InitiateCountdown(false, countdownSeconds, looping, holdTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <Include/ScriptCanvas/Libraries/Time/CountdownNodeable.generated.cpp>
|
||||
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
|
||||
#include <ScriptCanvas/Core/Nodeable.h>
|
||||
#include <ScriptCanvas/Core/NodeableNode.h>
|
||||
#include <ScriptCanvas/CodeGen/NodeableCodegen.h>
|
||||
|
||||
#include <Include/ScriptCanvas/Libraries/Time/CountdownNodeable.generated.h>
|
||||
|
||||
namespace ScriptCanvas
|
||||
{
|
||||
namespace Nodeables
|
||||
{
|
||||
namespace Time
|
||||
{
|
||||
class CountdownNodeable
|
||||
: public ScriptCanvas::Nodeable
|
||||
, public AZ::TickBus::Handler
|
||||
{
|
||||
NodeDefinition(CountdownNodeable, "Delay", "Counts down time from a specified value.",
|
||||
NodeTags::Category("Timing"),
|
||||
NodeTags::Version(0)
|
||||
);
|
||||
|
||||
public:
|
||||
virtual ~CountdownNodeable();
|
||||
|
||||
InputMethod("Start", "When signaled, execution is delayed at this node according to the specified properties.",
|
||||
SlotTags::Contracts({ DisallowReentrantExecutionContract }))
|
||||
void Start(float countdownSeconds, Data::BooleanType looping, float holdTime);
|
||||
|
||||
DataInput(float, "Start: Time", 0.0f, "", SlotTags::DisplayGroup("Start"));
|
||||
DataInput(Data::BooleanType, "Start: Loop", false, "", SlotTags::DisplayGroup("Start"));
|
||||
DataInput(float, "Start: Hold", 0.0f, "", SlotTags::DisplayGroup("Start"));
|
||||
|
||||
InputMethod("Reset", "When signaled, execution is delayed at this node according to the specified properties.",
|
||||
SlotTags::Contracts({ DisallowReentrantExecutionContract }))
|
||||
void Reset(float countdownSeconds, Data::BooleanType looping, float holdTime);
|
||||
|
||||
DataInput(float, "Reset: Time", 0.0f, "", SlotTags::DisplayGroup("Reset"));
|
||||
DataInput(Data::BooleanType, "Reset: Loop", false, "", SlotTags::DisplayGroup("Reset"));
|
||||
DataInput(float, "Reset: Hold", 0.0f, "", SlotTags::DisplayGroup("Reset"));
|
||||
|
||||
ExecutionLatentOutput("Done", "Signaled when the delay reaches zero.");
|
||||
DataOutput(float, "Elapsed", 0.0f, "The amount of time that has elapsed since the delay began.",
|
||||
SlotTags::DisplayGroup("Done"));
|
||||
|
||||
protected:
|
||||
void OnDeactivate() override;
|
||||
|
||||
// TickBus
|
||||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
|
||||
|
||||
private:
|
||||
void InitiateCountdown(bool reset, float countdownSeconds, bool looping, float holdTime);
|
||||
|
||||
float m_countdownSeconds = 0.0f;
|
||||
bool m_looping = false;
|
||||
float m_holdTime = 0.0f;
|
||||
float m_elapsedTime = 0.0f;
|
||||
bool m_holding = false;
|
||||
float m_currentTime = 0.0f;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue