浏览代码

Changes to incorporate the new energy cannon model and line up all its effects

Signed-off-by: kberg-amzn <[email protected]>
kberg-amzn 2 年之前
父节点
当前提交
5b2929b1ec

+ 3 - 1
Gem/Code/Source/AutoGen/EnergyCannonComponent.AutoComponent.xml

@@ -16,8 +16,10 @@
                        Description="Specifies the rate in milliseconds at which to fire projectiles, each cannon can only fire a single projectile at once so this also controls the projectile lifetime." />
     <ArchetypeProperty Type="AZ::TimeMs" Name="BallLifetimeMs" Init="" Container="Object" ExposeToEditor="true"
                        Description="Specifies the duration in milliseconds that the energy ball should live for. Must be less than the RateOfFireMs setting." />
+    <ArchetypeProperty Type="AZ::TimeMs" Name="BuildUpTimeMs" Init="" Container="Object" ExposeToEditor="true"
+                       Description="Specifies the number of milliseconds to start the build-up effect before shooting the next energy ball." />
     <ArchetypeProperty Type="GameEffect" Name="FiringEffect" Init="" Container="Object" ExposeToEditor="true" Description="Specifies the effect to play upon firing" />
     <ArchetypeProperty Type="AZ::EntityId" Name="EnergyBallEntity" ExposeToEditor="true" Description="The entity representing an energy ball." />
 
-    <RemoteProcedure Name="RPC_BallLaunched" InvokeFrom="Authority" HandleOn="Client" IsPublic="true" IsReliable="true" GenerateEventBindings="true" Description="Triggered on clients whenever a firing event occurs." />
+    <RemoteProcedure Name="RPC_TriggerBuildup" InvokeFrom="Authority" HandleOn="Client" IsPublic="true" IsReliable="true" GenerateEventBindings="true" Description="Triggered on clients to start the buildup event." />
 </Component>

+ 8 - 2
Gem/Code/Source/Components/Multiplayer/EnergyCannonComponent.cpp

@@ -37,7 +37,7 @@ namespace MultiplayerSample
     }
 
 #if AZ_TRAIT_CLIENT
-    void EnergyCannonComponent::HandleRPC_BallLaunched([[maybe_unused]] AzNetworking::IConnection* invokingConnection)
+    void EnergyCannonComponent::HandleRPC_TriggerBuildup([[maybe_unused]] AzNetworking::IConnection* invokingConnection)
     {
         m_effect.TriggerEffect(GetEntity()->GetTransform()->GetWorldTM());
     }
@@ -67,6 +67,12 @@ namespace MultiplayerSample
     }
 
 #if AZ_TRAIT_SERVER
+    void EnergyCannonComponentController::OnTriggerBuildup()
+    {
+        // This RPC starts the buildup effect on the client, we want it to start before the actual ball launch event occurs to make everyhing line up nicely
+        RPC_TriggerBuildup();
+    }
+
     void EnergyCannonComponentController::OnFireEnergyBall()
     {
         // Re-using the same ball entity.
@@ -80,10 +86,10 @@ namespace MultiplayerSample
                 const AZ::Vector3 forward = cannonTm.TransformVector(AZ::Vector3::CreateAxisY(-1.f));
                 const AZ::Vector3 effectOffset = GetFiringEffect().GetEffectOffset();
                 ballComponent->RPC_LaunchBall(cannonTm.GetTranslation() + effectOffset, forward, GetNetEntityId());
-                RPC_BallLaunched();
 
                 // Enqueue our ball kill event
                 m_killEvent.Enqueue(GetBallLifetimeMs(), false);
+                m_triggerBuildupEvent.Enqueue(GetRateOfFireMs() - GetBuildUpTimeMs(), false);
             }
         }
     }

+ 7 - 1
Gem/Code/Source/Components/Multiplayer/EnergyCannonComponent.h

@@ -23,7 +23,7 @@ namespace MultiplayerSample
         void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
 
 #if AZ_TRAIT_CLIENT
-        void HandleRPC_BallLaunched(AzNetworking::IConnection* invokingConnection) override;
+        void HandleRPC_TriggerBuildup(AzNetworking::IConnection* invokingConnection) override;
 #endif
 
     private:
@@ -41,6 +41,12 @@ namespace MultiplayerSample
 
 #if AZ_TRAIT_SERVER
     private:
+        void OnTriggerBuildup();
+        AZ::ScheduledEvent m_triggerBuildupEvent{ [this]()
+        {
+            OnTriggerBuildup();
+        }, AZ::Name("BuildupEnergyCannon") };
+
         void OnFireEnergyBall();
         AZ::ScheduledEvent m_firingEvent{[this]()
         {

+ 1 - 1
PopcornFX/Particles/EnergyBallTrap/FX_EnergyBallTrap_BuildUp.pkfx

@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:3d6bbf11787ec9f23613a0e9e4d1b8c2142dc1ed2333d064f31c81f15536cf5e
+oid sha256:993fee956f1794290c4a5a5e0f2ee5639cc2769da35547bf6cf4a716a9d3b21e
 size 270200

+ 28 - 5
Prefabs/Energy_Cannon_with_Energy_Ball.prefab

@@ -126,7 +126,7 @@
                     "Transform Data": {
                         "Translate": [
                             -9.5367431640625e-7,
-                            0.0,
+                            -0.30000001192092896,
                             0.6000000238418579
                         ],
                         "UniformScale": 0.5
@@ -287,6 +287,7 @@
                         "$type": "MultiplayerSample::EnergyCannonComponent",
                         "RateOfFireMs": 4000,
                         "BallLifetimeMs": 3800,
+                        "BuildUpTimeMs": 3300,
                         "FiringEffect": {
                             "ParticleAsset": {
                                 "guid": "{F16C718B-7B3D-5F6B-877C-0CA15AAE7544}"
@@ -294,7 +295,7 @@
                             "AudioTrigger": "play_sx_int_energyballtrap_buildup",
                             "EffectOffset": [
                                 0.0,
-                                0.0,
+                                0.6000000238418579,
                                 1.2000000476837158
                             ]
                         },
@@ -347,7 +348,8 @@
                                     "MaterialAsset": {
                                         "assetId": {
                                             "guid": "{7F678F45-39F0-573F-A178-34E76532397E}"
-                                        }
+                                        },
+                                        "assetHint": "spacecannon/spacecannon_base_mat.azmaterial"
                                     }
                                 }
                             }
@@ -362,22 +364,43 @@
                     "$type": "EditorMeshColliderComponent",
                     "Id": 9112722425705082704,
                     "ColliderConfiguration": {
+                        "Rotation": [
+                            0.0,
+                            -0.0,
+                            1.0,
+                            -0.0
+                        ],
                         "MaterialSlots": {
                             "Slots": [
                                 {
-                                    "Name": "Entire object"
+                                    "Name": "base_MAT"
                                 }
                             ]
                         }
                     },
                     "ShapeConfiguration": {
                         "PhysicsAsset": {
+                            "Asset": {
+                                "assetId": {
+                                    "guid": "{251F7A49-FA34-57EC-919D-399EAF8F9770}",
+                                    "subId": 1397975047
+                                },
+                                "assetHint": "spacecannon/spacecannon.pxmesh"
+                            },
                             "Configuration": {
                                 "Scale": [
                                     2.0,
                                     2.0,
                                     2.0
-                                ]
+                                ],
+                                "PhysicsAsset": {
+                                    "assetId": {
+                                        "guid": "{251F7A49-FA34-57EC-919D-399EAF8F9770}",
+                                        "subId": 1397975047
+                                    },
+                                    "loadBehavior": "QueueLoad",
+                                    "assetHint": "spacecannon/spacecannon.pxmesh"
+                                }
                             }
                         }
                     }