From d9dbd439d417835edfc72177bae24f64fe3baa90 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 6 Jan 2022 14:52:25 -0800 Subject: [PATCH] Removes CountdownNodeable.cpp/h from Gems/ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Libraries/Time/CountdownNodeable.cpp | 90 ------------------- .../Libraries/Time/CountdownNodeable.h | 75 ---------------- 2 files changed, 165 deletions(-) delete mode 100644 Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.cpp delete mode 100644 Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.h diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.cpp deleted file mode 100644 index 24544abac7..0000000000 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.cpp +++ /dev/null @@ -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 -#include - -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(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 diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.h deleted file mode 100644 index 98e9356b18..0000000000 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/CountdownNodeable.h +++ /dev/null @@ -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 - -#include -#include -#include - -#include - -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; - }; - } - } -}