You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.7 KiB
C++
83 lines
2.7 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
#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
|