!I (1670414, 1670415, 1670416, 1670424, 1670431):
[CRYENGINE.git] / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Audio / AudioAreaRandom.h
blob8f67b0e596b22e44ec95e9c3d1da5f21827ff05e
1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
3 #pragma once
5 #include "AudioEntitiesUtils.h"
6 #include "Legacy/Helpers/DesignerEntityComponent.h"
7 #include <CrySerialization/Decorators/ResourcesAudio.h>
9 class CAudioAreaRandom final
10 : public CDesignerEntityComponent<>
11 , public IEntityPropertyGroup
13 CRY_ENTITY_COMPONENT_INTERFACE_AND_CLASS_GUID(CAudioAreaRandom, "AudioAreaRandom", "8952d4d6-3e23-47d5-86ec-4724bf34789f"_cry_guid);
15 public:
16 CAudioAreaRandom() = default;
17 virtual ~CAudioAreaRandom() {}
19 // CNativeEntityBase
20 virtual uint64 GetEventMask() const override { return CDesignerEntityComponent::GetEventMask() | BIT64(ENTITY_EVENT_ENTERNEARAREA) | BIT64(ENTITY_EVENT_MOVENEARAREA) | BIT64(ENTITY_EVENT_ENTERAREA) | BIT64(ENTITY_EVENT_MOVEINSIDEAREA) | BIT64(ENTITY_EVENT_LEAVEAREA) | BIT64(ENTITY_EVENT_LEAVENEARAREA); }
21 virtual void ProcessEvent(const SEntityEvent& event) override;
23 virtual IEntityPropertyGroup* GetPropertyGroup() final { return this; }
25 virtual void OnResetState() override;
26 // ~CNativeEntityBase
28 // IEntityPropertyGroup
29 virtual const char* GetLabel() const override { return "AudioAreaRandom Properties"; }
31 virtual void SerializeProperties(Serialization::IArchive& archive) override;
32 // ~IEntityPropertyGroup
34 protected:
35 void Play();
36 void Stop();
37 Vec3 GenerateOffset();
38 void UpdateFadeValue(float distance);
39 void UpdateRtpc();
40 const bool IsPlaying() const { return m_currentlyPlayingTriggerId != CryAudio::InvalidControlId; }
42 CryAudio::ControlId m_playTriggerId = CryAudio::InvalidControlId;
43 CryAudio::ControlId m_stopTriggerId = CryAudio::InvalidControlId;
44 CryAudio::ControlId m_parameterId = CryAudio::InvalidControlId;
46 CryAudio::ControlId m_currentlyPlayingTriggerId = CryAudio::InvalidControlId;
48 string m_playTriggerName;
49 string m_stopTriggerName;
51 string m_parameterName;
53 CryAudio::EOcclusionType m_occlusionType = CryAudio::EOcclusionType::Ignore;
55 bool m_bTriggerAreasOnMove = false;
56 bool m_bMoveWithEntity = false;
58 float m_minDelay = 0.0f;
59 float m_maxDelay = 1000.0f;
60 float m_radius = 10.0f;
61 float m_fadeValue = 0.0;
62 bool m_bEnabled = true;
63 EAreaState m_areaState = EAreaState::Outside;
64 float m_parameterDistance = 5.0f;
66 bool m_bPlaying = false;
67 int m_timerId = 0;