Integrating latest 47acbe8
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from ActorSplitsAfterDamage import Tests
|
||||
|
||||
def run():
|
||||
from ActorSplitsAfterDamage import run as internal_run
|
||||
from Utils import Constants
|
||||
|
||||
def CapsuleDamage(target_id, position0):
|
||||
position1 = azlmbr.object.construct('Vector3', position0.x + 1.0, position0.y, position0.z)
|
||||
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Capsule Damage", target_id,
|
||||
position0, position1,
|
||||
Constants.DAMAGE_MIN_RADIUS,
|
||||
Constants.DAMAGE_MAX_RADIUS, Constants.DAMAGE_AMOUNT)
|
||||
|
||||
internal_run(CapsuleDamage)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,110 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_moving = ("Moving entity found", "Moving entity not found")
|
||||
find_destructable = ("Destructable entity found", "Destructable entity not found")
|
||||
find_root_actor = ("Root actor of destructable entity found", "Root actor of destructable entity not found")
|
||||
collisions = ("Collision occurred between entities", "Collision did not occur between entities")
|
||||
root_actor_destroyed = ("Root actor destroyed", "Root actor was not destroyed")
|
||||
child_actors_created = ("Child actors created", "Child actors were not created")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def run():
|
||||
|
||||
"""
|
||||
Summary:
|
||||
Open a Project that already has 1 rigid sphere entity and 1 destructable entity and verify collision and damage
|
||||
to destructable entity.
|
||||
|
||||
Level Description:
|
||||
Moving Sphere and Destructable entities are created in level with same collision layer and same collision group.
|
||||
Moving Sphere entity is placed above the Destructable entity.
|
||||
|
||||
Expected Behavior:
|
||||
Moving Sphere has to collide with Destructable entity under the effect of gravity. Destructable entity root actor
|
||||
should be destroyed and 2 child actors should be created to replace it.
|
||||
|
||||
Test Steps:
|
||||
1) Open level and Enter game mode
|
||||
2) Retrieve and validate Entities
|
||||
3) Get the entity representing root actor of destructable entity
|
||||
4) Check moving sphere collides with root actor of destructable entity due to gravity
|
||||
5) Check root actor is destroyed
|
||||
6) Check child actors of root actor are created
|
||||
7) Exit game mode
|
||||
8) Close the editor
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.bus
|
||||
|
||||
from Utils import CollisionHandler
|
||||
from Utils import BlastNotificationHandler
|
||||
|
||||
# Constants
|
||||
TIMEOUT = 2.0
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
# 1) Open level and Enter game mode
|
||||
helper.open_level("Blast", "Blast_ActorSplitsAfterCollision")
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 2) Retrieve and validate Entities
|
||||
moving_id = general.find_game_entity("Sphere_Moving")
|
||||
Report.critical_result(Tests.find_moving, moving_id.IsValid())
|
||||
|
||||
destructable_id = general.find_game_entity("Destructable_Box")
|
||||
Report.critical_result(Tests.find_destructable, destructable_id.IsValid())
|
||||
|
||||
# 3) Get the entity representing root actor of destructable entity
|
||||
destructable_initial_actors = azlmbr.destruction.BlastFamilyComponentRequestBus(azlmbr.bus.Event, "Get Actors Data", destructable_id)
|
||||
Report.critical_result(Tests.find_root_actor, len(destructable_initial_actors) == 1)
|
||||
destructable_initial_actor_id = destructable_initial_actors[0].EntityId
|
||||
|
||||
collision = CollisionHandler(destructable_initial_actor_id, moving_id)
|
||||
family_handler = BlastNotificationHandler(destructable_id)
|
||||
|
||||
# 4) Check moving sphere collides with root actor of destructable entity due to gravity
|
||||
helper.wait_for_condition(lambda: collision.collision_happened, TIMEOUT)
|
||||
Report.result(Tests.collisions, collision.collision_happened)
|
||||
|
||||
# 5) Check root actor is destroyed
|
||||
helper.wait_for_condition(lambda: family_handler.actors_destroyed == 1, TIMEOUT)
|
||||
Report.result(Tests.root_actor_destroyed, family_handler.actors_destroyed == 1)
|
||||
|
||||
# 6) Check child actors of root actor are created
|
||||
helper.wait_for_condition(lambda: family_handler.actors_created == 2, TIMEOUT)
|
||||
Report.result(Tests.child_actors_created, family_handler.actors_created == 2)
|
||||
|
||||
# 7) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 8) Close the editor
|
||||
helper.close_editor()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,97 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_destructable = ("Destructable entity found", "Destructable entity not found")
|
||||
find_root_actor = ("Root actor of destructable entity found", "Root actor of destructable entity not found")
|
||||
root_actor_destroyed = ("Root actor destroyed", "Root actor was not destroyed")
|
||||
child_actors_created = ("Child actors created", "Child actors were not created")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def run(damage_func):
|
||||
|
||||
"""
|
||||
Summary:
|
||||
Open a Project that already has 1 destructable entity and verify damage destructs it.
|
||||
|
||||
Level Description:
|
||||
Destructable entity is in a level.
|
||||
|
||||
Expected Behavior:
|
||||
Damage is applied to destructable entity. Destructable entity root actor
|
||||
should be destroyed and 2 child actors should be created to replace it.
|
||||
|
||||
Test Steps:
|
||||
1) Open level and Enter game mode
|
||||
2) Retrieve and validate Entities
|
||||
3) Get the entity representing root actor of destructable entity
|
||||
4) Apply damage to the destructable entity
|
||||
5) Check root actor is destroyed
|
||||
6) Check child actors of root actor are created
|
||||
7) Exit game mode
|
||||
8) Close the editor
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.bus
|
||||
|
||||
from Utils import BlastNotificationHandler
|
||||
|
||||
# Constants
|
||||
TIMEOUT = 2.0
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
# 1) Open level and Enter game mode
|
||||
helper.open_level("Blast", "Blast_ActorSplitsAfterDamage")
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 2) Retrieve and validate Entities
|
||||
destructable_id = general.find_game_entity("Destructable_Box")
|
||||
Report.critical_result(Tests.find_destructable, destructable_id.IsValid())
|
||||
|
||||
# 3) Get the entity representing root actor of destructable entity
|
||||
destructable_initial_actors = azlmbr.destruction.BlastFamilyComponentRequestBus(azlmbr.bus.Event, "Get Actors Data", destructable_id)
|
||||
Report.critical_result(Tests.find_root_actor, len(destructable_initial_actors) == 1)
|
||||
destructable_initial_actor_id = destructable_initial_actors[0].EntityId
|
||||
initial_actor_position = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", destructable_initial_actor_id)
|
||||
|
||||
# 4) Apply damage to the destructable entity
|
||||
damage_func(destructable_id, initial_actor_position)
|
||||
|
||||
family_handler = BlastNotificationHandler(destructable_id)
|
||||
|
||||
# 5) Check root actor is destroyed
|
||||
helper.wait_for_condition(lambda: family_handler.actors_destroyed == 1, TIMEOUT)
|
||||
Report.result(Tests.root_actor_destroyed, family_handler.actors_destroyed == 1)
|
||||
|
||||
# 6) Check child actors of root actor are created
|
||||
helper.wait_for_condition(lambda: family_handler.actors_created == 2, TIMEOUT)
|
||||
Report.result(Tests.child_actors_created, family_handler.actors_created == 2)
|
||||
|
||||
# 7) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
# 8) Close the editor
|
||||
helper.close_editor()
|
||||
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from ActorSplitsAfterDamage import Tests
|
||||
|
||||
def run():
|
||||
from ActorSplitsAfterDamage import run as internal_run
|
||||
from Utils import Constants
|
||||
|
||||
def ImpactSpreadDamage(target_id, position):
|
||||
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Impact Spread Damage", target_id,
|
||||
position, Constants.DAMAGE_MIN_RADIUS,
|
||||
Constants.DAMAGE_MAX_RADIUS, Constants.DAMAGE_AMOUNT)
|
||||
|
||||
internal_run(ImpactSpreadDamage)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from ActorSplitsAfterDamage import Tests
|
||||
|
||||
def run():
|
||||
from ActorSplitsAfterDamage import run as internal_run
|
||||
from Utils import Constants
|
||||
|
||||
def RadialDamage(target_id, position):
|
||||
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Radial Damage", target_id,
|
||||
position, Constants.DAMAGE_MIN_RADIUS,
|
||||
Constants.DAMAGE_MAX_RADIUS, Constants.DAMAGE_AMOUNT)
|
||||
|
||||
internal_run(RadialDamage)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from ActorSplitsAfterDamage import Tests
|
||||
|
||||
def run():
|
||||
from ActorSplitsAfterDamage import run as internal_run
|
||||
from Utils import Constants
|
||||
|
||||
def ShearDamage(target_id, position):
|
||||
normal = azlmbr.object.construct('Vector3', 1.0, 0.0, 0.0)
|
||||
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Shear Damage", target_id,
|
||||
position, normal, Constants.DAMAGE_MIN_RADIUS,
|
||||
Constants.DAMAGE_MAX_RADIUS, Constants.DAMAGE_AMOUNT)
|
||||
|
||||
internal_run(ShearDamage)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from ActorSplitsAfterDamage import Tests
|
||||
|
||||
def run():
|
||||
from ActorSplitsAfterDamage import run as internal_run
|
||||
from Utils import Constants
|
||||
|
||||
def StressDamage(target_id, position):
|
||||
force = azlmbr.object.construct('Vector3', 0.0, 0.0, -100.0) # Should be enough to break `brittle` objects
|
||||
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Stress Damage", target_id,
|
||||
position, force)
|
||||
|
||||
internal_run(StressDamage)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from ActorSplitsAfterDamage import Tests
|
||||
|
||||
def run():
|
||||
from ActorSplitsAfterDamage import run as internal_run
|
||||
from Utils import Constants
|
||||
|
||||
def TriangleDamage(target_id, position):
|
||||
# Some points that form a triangle that contains the given position
|
||||
position0 = azlmbr.object.construct('Vector3', position.x, position.y + 1.0, position.z)
|
||||
position1 = azlmbr.object.construct('Vector3', position.x + 1.0, position.y - 1.0, position.z)
|
||||
position2 = azlmbr.object.construct('Vector3', position.x - 1.0, position.y - 1.0, position.z)
|
||||
azlmbr.destruction.BlastFamilyDamageRequestBus(azlmbr.bus.Event, "Triangle Damage", target_id,
|
||||
position0, position1, position2,
|
||||
Constants.DAMAGE_AMOUNT)
|
||||
|
||||
internal_run(TriangleDamage)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
@@ -0,0 +1,15 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
def init():
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
|
||||
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
# This suite consists of all test cases that are passing and have been verified.
|
||||
|
||||
import pytest
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ly_test_tools import LAUNCHERS
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
|
||||
|
||||
from base import TestAutomationBase
|
||||
|
||||
@pytest.mark.SUITE_periodic
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(TestAutomationBase):
|
||||
def test_ActorSplitsAfterCollision(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterCollision as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
|
||||
def test_ActorSplitsAfterRadialDamage(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterRadialDamage as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
|
||||
def test_ActorSplitsAfterCapsuleDamage(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterCapsuleDamage as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
|
||||
def test_ActorSplitsAfterImpactSpreadDamage(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterImpactSpreadDamage as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
|
||||
def test_ActorSplitsAfterShearDamage(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterShearDamage as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
|
||||
def test_ActorSplitsAfterTriangleDamage(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterTriangleDamage as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
|
||||
def test_ActorSplitsAfterStressDamage(self, request, workspace, editor, launcher_platform):
|
||||
from . import ActorSplitsAfterStressDamage as test_module
|
||||
self._run_test(request, workspace, editor, test_module, expected_lines=[], unexpected_lines=["Assert"])
|
||||
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
import azlmbr
|
||||
from enum import Enum
|
||||
|
||||
class Constants():
|
||||
DAMAGE_MIN_RADIUS = 1.0
|
||||
DAMAGE_MAX_RADIUS = 1.0
|
||||
DAMAGE_AMOUNT = 10.0 # Enough to break a `brittle` object
|
||||
|
||||
|
||||
class CollisionHandler:
|
||||
def __init__(self, id, target_id):
|
||||
self.id = id
|
||||
self.target_id = target_id
|
||||
self.collision_happened = False
|
||||
self.create_collision_handler()
|
||||
|
||||
def on_collision_begin(self, args):
|
||||
if args[0].Equal(self.target_id):
|
||||
self.collision_happened = True
|
||||
|
||||
def create_collision_handler(self):
|
||||
self.handler = azlmbr.physics.CollisionNotificationBusHandler()
|
||||
self.handler.connect(self.id)
|
||||
self.handler.add_callback("OnCollisionBegin", self.on_collision_begin)
|
||||
|
||||
|
||||
class BlastNotificationHandler:
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
self.actors_destroyed = 0
|
||||
self.actors_created = 0
|
||||
self.create_collision_handler()
|
||||
|
||||
def on_actor_created(self, args):
|
||||
self.actors_created += 1
|
||||
|
||||
def on_actor_destroyed(self, args):
|
||||
self.actors_destroyed += 1
|
||||
|
||||
def create_collision_handler(self):
|
||||
self.handler = azlmbr.destruction.BlastFamilyComponentNotificationBusHandler()
|
||||
self.handler.connect(self.id)
|
||||
self.handler.add_callback("On Actor Created", self.on_actor_created)
|
||||
self.handler.add_callback("On Actor Destroyed", self.on_actor_destroyed)
|
||||
@@ -0,0 +1,10 @@
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
Reference in New Issue
Block a user