Update App.java

This commit is contained in:
YanchaoMiao 2020-05-24 19:09:13 +08:00 committed by Ilkka Seppälä
parent a4d77e65f8
commit 35ad973730
No known key found for this signature in database
GPG Key ID: 31B7C8F5CC412ECB

View File

@ -37,7 +37,7 @@ import java.util.ArrayList;
* components, in another way, multiple components can construct a object. * components, in another way, multiple components can construct a object.
* Here is a demo using component pattern to solve a game-like problem. * Here is a demo using component pattern to solve a game-like problem.
* A person named Bjorn who has three components: input;physics;graphics * A person named Bjorn who has three components: input;physics;graphics
* These three components with a common game object can construct our protagonist:Bjorn, also can * These three component with a common game object can construct our protagonist:Bjorn, also can
* construct other objects like dog or cat if you want to write a real game. * construct other objects like dog or cat if you want to write a real game.
*/ */
@ -46,11 +46,11 @@ public class App {
* Launcher for this demo design pattern * Launcher for this demo design pattern
*/ */
public static void main(String[] args) { public static void main(String[] args) {
ArrayList<Component> arrayList = new ArrayList<>(); var arrayList = new ArrayList<Component>();
arrayList.add(new BjornInputComponent()); arrayList.add(new BjornInputComponent());
arrayList.add(new BjornPhysicsComponent()); arrayList.add(new BjornPhysicsComponent());
arrayList.add(new BjornGraphicsComponent()); arrayList.add(new BjornGraphicsComponent());
GameObject gameObject = new GameObject(arrayList); var gameObject = new GameObject(arrayList);
gameObject.update(); gameObject.update();
} }
} }