Przeglądaj źródła

formatting

Signed-off-by: Adam Dabrowski <[email protected]>
Adam Dabrowski 2 lat temu
rodzic
commit
564af29ea0

+ 14 - 13
Project/Gem/Source/ApplePicker/GatheringRowComponent.cpp

@@ -19,16 +19,16 @@ namespace AppleKraken
     {
         if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
         {
-            serialize->Class<GatheringRowComponent, AZ::Component>()
-                ->Version(4)
-                ->Field("PoseOffset", &GatheringRowComponent::m_poseOffset);
+            serialize->Class<GatheringRowComponent, AZ::Component>()->Version(4)->Field("PoseOffset", &GatheringRowComponent::m_poseOffset);
 
             if (AZ::EditContext* ec = serialize->GetEditContext())
             {
-                ec->Class<GatheringRowComponent>("Gathering Row Component", "Poses (points with orientation) suitable for apple gathering."
-                                                                            "Component will return as navigation plan all its children "
-                                                                            "with name containing \'GatherPoint\'. "
-                                                                            "Points are sorted with entity name.")
+                ec->Class<GatheringRowComponent>(
+                      "Gathering Row Component",
+                      "Poses (points with orientation) suitable for apple gathering."
+                      "Component will return as navigation plan all its children "
+                      "with name containing \'GatherPoint\'. "
+                      "Points are sorted with entity name.")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                     ->Attribute(AZ::Edit::Attributes::Category, "AppleKraken")
                     ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
@@ -65,22 +65,23 @@ namespace AppleKraken
         }
         // Simplification - we assume same orientations along the way
         AZStd::map<AZStd::string, AZ::EntityId> sorted_names;
-        for (const auto& entity_id:descendants)
+        for (const auto& entity_id : descendants)
         {
             AZStd::string entity_name;
             AZ::ComponentApplicationBus::BroadcastResult(entity_name, &AZ::ComponentApplicationRequests::GetEntityName, entity_id);
-            if (entity_id.IsValid()) {
-                if (entity_name.contains("GatherPoint")) {
+            if (entity_id.IsValid())
+            {
+                if (entity_name.contains("GatherPoint"))
+                {
                     sorted_names[entity_name] = entity_id;
                 }
             }
         }
-        for (const auto &[_, entity_id]:sorted_names)
+        for (const auto& [_, entity_id] : sorted_names)
         {
             AZ::Transform pose;
             AZ::TransformBus::EventResult(pose, entity_id, &AZ::TransformBus::Events::GetWorldTM);
-            pose = pose * AZ::Transform::CreateFromQuaternionAndTranslation(AZ::Quaternion::CreateIdentity(),
-                                                                            m_poseOffset);
+            pose = pose * AZ::Transform::CreateFromQuaternionAndTranslation(AZ::Quaternion::CreateIdentity(), m_poseOffset);
             m_gatheringPoses.emplace_back(pose);
         }
     }

+ 14 - 14
Project/Gem/Source/DemoStatistics/DemoStatisticsComponent.cpp

@@ -24,7 +24,7 @@ namespace AppleKraken
         m_applesFailed = 0;
 
         // default to our own EntityId if no UI entity is specified
-        if(!m_uiEntity.IsValid())
+        if (!m_uiEntity.IsValid())
         {
             m_uiEntity = GetEntityId();
         }
@@ -39,8 +39,7 @@ namespace AppleKraken
     {
         if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
         {
-            serialize->Class<DemoStatisticsComponent, AZ::Component>()->Version(1)->Field(
-                "UiEntity", &DemoStatisticsComponent::m_uiEntity);
+            serialize->Class<DemoStatisticsComponent, AZ::Component>()->Version(1)->Field("UiEntity", &DemoStatisticsComponent::m_uiEntity);
 
             if (AZ::EditContext* ec = serialize->GetEditContext())
             {
@@ -62,7 +61,9 @@ namespace AppleKraken
         if (IsFailed(appleEvent))
         {
             m_applesFailed++;
-        }else{
+        }
+        else
+        {
             m_applesGathered++;
         }
         DisplayNumberOfApples();
@@ -70,16 +71,16 @@ namespace AppleKraken
 
     void DemoStatisticsComponent::OnApplePickerSpawned(const AZ::EntityId& entityId)
     {
-        m_applePickerStatus.push_back({entityId,"READY"});
+        m_applePickerStatus.push_back({ entityId, "READY" });
         UpdateTextField(m_applePickerCountElementName, "", m_applePickerStatus.size());
         DisplayStatus();
     }
 
     void DemoStatisticsComponent::SetApplePickerStatus(const AZ::EntityId& entityId, const AZStd::string& status)
     {
-        for(ApplePickerStatus& applePicker : m_applePickerStatus)
+        for (ApplePickerStatus& applePicker : m_applePickerStatus)
         {
-            if(applePicker.m_entityId == entityId)
+            if (applePicker.m_entityId == entityId)
             {
                 applePicker.m_status = status;
                 break;
@@ -114,17 +115,17 @@ namespace AppleKraken
     {
         UpdateTextField(m_applePickerCountElementName, "", static_cast<uint16_t>(m_applePickerStatus.size()));
         int row = 0;
-        for(const ApplePickerStatus& applePicker : m_applePickerStatus)
+        for (const ApplePickerStatus& applePicker : m_applePickerStatus)
         {
             // increment row here so the display number starts at 1
-            const AZStd::string& elementName = AZStd::string::format("%s%d",m_applePickerStatusElementName.c_str(), row++);
-            const AZStd::string& label = AZStd::string::format("APPLEKRAKEN%d    %s",row, applePicker.m_status.c_str());
+            const AZStd::string& elementName = AZStd::string::format("%s%d", m_applePickerStatusElementName.c_str(), row++);
+            const AZStd::string& label = AZStd::string::format("APPLEKRAKEN%d    %s", row, applePicker.m_status.c_str());
             UpdateTextField(elementName, label, 0, true);
         }
     }
 
-
-    void DemoStatisticsComponent::UpdateTextField(const AZStd::string& fieldName, const AZStd::string& label, uint16_t counter, bool labelOnly)
+    void DemoStatisticsComponent::UpdateTextField(
+        const AZStd::string& fieldName, const AZStd::string& label, uint16_t counter, bool labelOnly)
     {
         AZ::EntityId uiCanvas;
         EBUS_EVENT_ID_RESULT(uiCanvas, m_uiEntity, UiCanvasRefBus, GetCanvas);
@@ -142,7 +143,7 @@ namespace AppleKraken
             return;
         }
 
-        if(labelOnly)
+        if (labelOnly)
         {
             UiTextBus::Event(uiTextEntity, &UiTextInterface::SetText, label);
         }
@@ -150,6 +151,5 @@ namespace AppleKraken
         {
             UiTextBus::Event(uiTextEntity, &UiTextInterface::SetText, AZStd::string::format("%s %d", label.c_str(), counter));
         }
-
     }
 } // namespace AppleKraken

+ 3 - 2
Project/Gem/Source/DemoStatistics/DemoStatisticsComponent.h

@@ -45,10 +45,11 @@ namespace AppleKraken
         const AZStd::string m_applePickerStatusElementName = "ApplePickerStatus";
 
         AZ::EntityId m_uiEntity;
-        struct ApplePickerStatus {
+        struct ApplePickerStatus
+        {
             AZ::EntityId m_entityId;
             AZStd::string m_status;
-        }; 
+        };
         AZStd::list<ApplePickerStatus> m_applePickerStatus;
         uint16_t m_applesGathered = 0;
         uint16_t m_applesFailed = 0;