forked from markfloryan/gamedesign
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.html
90 lines (90 loc) · 6.57 KB
/
events.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<h1 id="cs4730---hw-5-events-and-ui">CS4730 - HW 5: Events and UI</h1>
<h2 id="github-assignment-link"><a name="background"></a>Github Assignment Link</h2>
<p>Every assignment has a <strong>Github Classroom Link</strong> you must follow to get the starter code (if applicable) and to create your repository for the assignment. If you haven’t yet done so, follow the instructions at the <a href="./githubclassroom.html">Github Classroom Tutorial</a>.</p>
<p><strong>Assignment Invite Link</strong>: <a href="https://classroom.github.com/a/6HFGQiFE">HW 5 Invite Link</a></p>
<p>Once your repository is configured, push your code to it in order to submit your work.</p>
<h2 id="background-and-resources"><a name="background"></a>Background and Resources</h2>
<p>For this assignment, you will produce small demos that show basic functionality for menus, simple events (opening a door), and UI elements. You might want to peruse the following resources as you work on your assignment: - <a href="https://www.youtube.com/watch?v=zc8ac_qUXQY">Main Menu Tutorial</a> - <a href="https://docs.unity3d.com/Manual/UIToolkits.html">UI Toolkits</a> - <a href="https://docs.unity3d.com/Manual/UnityEvents.html">Unity Events</a> - <a href="https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html">Scene Manager</a> - <a href="https://docs.unity3d.com/ScriptReference/Coroutine.html">Coroutines</a></p>
<h2 id="required-features-3-features-33-to-pass"><a name="required"></a>Required Features (3 features, 3/3 to pass)</h2>
<p>These required features are meant to force you to implement very simple versions of common game elements. These can easily be expanded to more complicated elements in your game projects.</p>
<ul>
<li><strong>Main Menu</strong>
<ul>
<li>Open the <code>MainMenu</code> scene and create a menu around the template Canvas which must include:
<ul>
<li>Title Text (anything you want!)</li>
<li>Play Button (opens the <code>Game</code> scene when pressed)
<ul>
<li>Use the <code>SceneLoader</code> object’s <code>SceneLoader.cs</code> script to load a new scene.</li>
<li>Note: Scenes needed to be added to the build settings to be able to switch to them (Ctrl+Shift+B)</li>
</ul></li>
<li>Volume Slider (adjust music volume)</li>
<li>Credits Button (opens new UI panel showing credits for the game. That’s you!)
<ul>
<li>Should have a back button to go back to the Main UI</li>
</ul></li>
</ul></li>
</ul></li>
<li><strong>Opening Door</strong>
<ul>
<li>Open the <code>Door</code> scene. In it, a box is suspended above a button and there is a door on the right. When you press play, the box will fall on the button. Modify the <code>PressurePlate.cs</code> script on the Button and add a UnityEvent to trigger when the plate is pressed down and when it stops being pressed down.</li>
<li>Modify the <code>Open()</code> and <code>Close()</code> functions in the <code>Door.cs</code> script on the door GameObject to open and close the door respectively in any manner you wish.</li>
<li>Set the <code>Open()</code> and <code>Close()</code> functions as subscribers to the PressurePlate <code>Down</code> and <code>Up</code> events respectively.</li>
<li>Note: public void UnityEvents (ones with no parameters) will appear in the Inspector window, and you can subscribe events directly there instead of in code.</li>
</ul></li>
<li><strong>Counting Jumps</strong>
<ul>
<li>Open the <code>JumpCounting</code> scene. In it, a box jumps every time you press space.</li>
<li>Modify the <code>JumpBox.cs</code> script on the Box GameObject
<ul>
<li>Add a <code>UnityEvent<int></code> to be trigger On Jump and an <code>int</code> to count the number of jumps.</li>
<li>Every time the player pressed space, the On Jump event should fire, passing in the jump count</li>
<li>Subscribe the UI to the event to update its text every time a jump occurs.</li>
</ul></li>
<li>Add a text UI element for indicating the number of jumps.
<ul>
<li>Give it the <code>JumpUI.cs</code> script component, and create a function with the signature <code>void UpdateJumpUI (int count)</code>. This function should update the text to count.</li>
<li>Get a reference to the JumpBox script and subscribe UpdateJumpUI to the On Jump event.</li>
</ul></li>
<li>Subscribe something else to the On Jump event. This can be anything you want, and will likely involve creating your own script to subscribe it to the event.
<ul>
<li>Note: Must be obvious for the purposes of grading. Some ideas include: confetti explosion, sound effect, post processing effect, camera shake, etc. Get creative!</li>
</ul></li>
</ul></li>
</ul>
<h2 id="optional-features"><a name="optional"></a>Optional Features</h2>
<p>There are 8 optional points available through this assignment.</p>
<ul>
<li><strong>Custom Event System (2 points)</strong>
<ul>
<li>Instead of using UnityEvents, create your own event system using C# events and delegates</li>
</ul></li>
<li><strong>Custom UI (2 points)</strong>
<ul>
<li>You can replace the sprites on all UI elements in Unity. After a while, the default Unity UI gets really boring and lame. Find some cool UI assets online or make your own and replace all the default UI in the <code>MainMenu</code> scene.</li>
<li>(UI is the first thing people see in your game, so make sure its good!)</li>
</ul></li>
<li><strong>Audio Mixing (1 point)</strong>
<ul>
<li>AudioMixers are a really useful asset that are used to adjust an entire channel/group of audio sources at once (i.e. master volume). They can even add effects!</li>
<li>Create a new <code>AudioMixer</code> asset and adjust its volume instead of directly changing the volume of the music.</li>
<li>Check out the documentation on AudioMixers for more details as to how they work.</li>
</ul></li>
<li><strong>Scene Transitions (2 points)</strong>
<ul>
<li>Modify the <code>SceneLoader</code> GameObject
<ul>
<li>Add a child <code>Image</code> UI component, set its sprite to a basic square, set the color to black, and have it <a href="https://answers.unity.com/questions/1250052/set-the-ui-image-to-fit-screen-size.html">fill the entire screen</a>.</li>
</ul></li>
<li>Modify the <code>SceneLoader.cs</code> script
<ul>
<li>Instead of just setting the new scene, setup a coroutine to fade the screen out, then switch scenes, then fade the screen in.</li>
</ul></li>
</ul></li>
<li><strong>Text Mesh Pro (1 point)</strong>
<ul>
<li>For all applicable UI elements, use TextMeshPro (TMP) instead of the standard UI.</li>
<li>The difference is that TMP converts UI to a mesh, allowing it to scale infinitely without getting blurry.</li>
<li>This should be trivial. If a UI element has two variants, use the one that says TextMeshPro.</li>
</ul></li>
</ul>