diff --git a/GameEngine/src/main/java/gameEngine/entites/GameObject.java b/GameEngine/src/main/java/gameEngine/entites/GameObject.java index da2e510..a8f3a7b 100644 --- a/GameEngine/src/main/java/gameEngine/entites/GameObject.java +++ b/GameEngine/src/main/java/gameEngine/entites/GameObject.java @@ -56,4 +56,13 @@ } } + public T getComponent(Class componentClass){ + for (GameComponent gameComponent :gameComponents) { + if (componentClass.isInstance(gameComponent)) { + return componentClass.cast(gameComponent); + } + } + return null; + } + } \ No newline at end of file