Assignment 11
- Facade Pattern -
The objective of this assignment was to create a game feature with Unity and C# that uses an implementation of the facade design pattern.
Play the Game
UML Diagram
- Complex Object Spawning -
Utilizing the Facade Pattern
Questions and Answers
1. Briefly, what was the game feature you chose to create?
The game feature I chose to create was a tool that draws shapes on the screen, and each shape is drawn in a unique way.
​
2. What is the player able to do with the game feature you chose to create?
As a player, I want to draw shapes to the screen so I can add dynamic, complex art to the game world.
​
3. What components does your Facade have? In other words, what subsystem classes does your Facade class hold references to?
The facade class, ShapeDrawer, holds references to the IShape prefabs that can be drawn to the screen. The facade class instantiates these prefabs and calls their Draw() methods.
​
4. What actions are you simplifying into a higher-level set of actions with the Facade design pattern? In other words, briefly describe what the higher-level actions are that your Facade does using its subsystem components.
The Facade simplifies the instantiation and initialization of these shapes. Instead of obtaining the prefab, instantiating it, and calling the Draw() method myself, I can simply pass in a ShapeType (enum) and a position into my Facade class and have it draw the shape for me.
​
5. What were the benefits of using the Facade Pattern to make your game feature?
The Facade pattern helped simplify a process that would otherwise be complicated and repetitive to implement.
​
6. Did you find any drawbacks to using the Facade Pattern? If so, what were they?
No drawbacks with the pattern itself. I do, though, keep thinking about other things that might be a Facade that I use often. For example, if I have a CharacterMotor class that handles the complex movement of an in-game character, and a class PlayerCharacterController that is composed with a CharacterMotor, would the PlayerCharacterController be the client and the CharacterMotor be the Facade class that provides an interface for actually moving the character? Just a thought.
​
7. How is the goal of the game feature communicated to the player in your unity project?
The goal is communicated via instructions on the top of the screen.
​
8. How are the controls required to use the game feature you created communicated to the player in your unity project?
Controls are on top of the screen.
​
9. How does the game communicate to players whether or not they have successfully used the game feature?
The player will know they used the game feature once a shape is drawn to the screen.