88 lines
3.1 KiB
C++
88 lines
3.1 KiB
C++
/*
|
|
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
|
* its licensors.
|
|
*
|
|
* For complete copyright and license terms please see the LICENSE at the root of this
|
|
* distribution (the "License"). All use of this software is governed by the License,
|
|
* or, if provided, by the license below or the license accompanying this file. Do not
|
|
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include <AzCore/Component/Component.h>
|
|
#include <AreaSystemComponent.h>
|
|
#include <InstanceSystemComponent.h>
|
|
#include <Vegetation/Ebuses/LevelSettingsRequestBus.h>
|
|
|
|
namespace LmbrCentral
|
|
{
|
|
template<typename, typename>
|
|
class EditorWrappedComponentBase;
|
|
}
|
|
|
|
namespace Vegetation
|
|
{
|
|
/*
|
|
* The settings for the area and instance managers
|
|
*/
|
|
class LevelSettingsConfig
|
|
: public AZ::ComponentConfig
|
|
{
|
|
public:
|
|
AZ_CLASS_ALLOCATOR(LevelSettingsConfig, AZ::SystemAllocator, 0);
|
|
AZ_RTTI(LevelSettingsConfig, "{794F7DE4-188C-4031-8B00-C2BA0C351A1E}", AZ::ComponentConfig);
|
|
static void Reflect(AZ::ReflectContext* context);
|
|
|
|
AreaSystemConfig m_areaSystemConfig;
|
|
InstanceSystemConfig m_instanceSystemConfig;
|
|
};
|
|
|
|
static const AZ::Uuid LevelSettingsComponentTypeId = "{FDF8520C-933F-4ED5-9B3A-4ABC9B62496C}";
|
|
|
|
/*
|
|
* Sends out updates for the settings for the area and instance managers
|
|
*/
|
|
class LevelSettingsComponent
|
|
: public AZ::Component
|
|
, private LevelSettingsRequestBus::Handler
|
|
{
|
|
public:
|
|
template<typename, typename> friend class LmbrCentral::EditorWrappedComponentBase;
|
|
AZ_COMPONENT(LevelSettingsComponent, LevelSettingsComponentTypeId);
|
|
static void Reflect(AZ::ReflectContext* context);
|
|
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
|
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
|
|
|
LevelSettingsComponent(const LevelSettingsConfig& configuration);
|
|
LevelSettingsComponent() = default;
|
|
~LevelSettingsComponent() override;
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// AZ::Component interface implementation
|
|
void Init() override;
|
|
void Activate() override;
|
|
void Deactivate() override;
|
|
bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
|
|
bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const override;
|
|
|
|
protected:
|
|
void UpdateSystemConfig();
|
|
|
|
LevelSettingsConfig m_configuration;
|
|
AreaSystemConfig m_previousAreaSystemConfig;
|
|
InstanceSystemConfig m_previousInstanceSystemConfig;
|
|
bool m_componentActivated = false;
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// LevelSettingsRequestBus
|
|
AreaSystemConfig* GetAreaSystemConfig() override;
|
|
InstanceSystemConfig* GetInstanceSystemConfig() override;
|
|
|
|
bool m_active = false;
|
|
};
|
|
|
|
} // namespace Vegetation
|