This is worth 4% of your final grade and is due whenever Canvas says it is due. (This is most likely Wednesday, January 11.)
Whichever option you choose (singular – no extra credit will be granted for doing both), you must strictly follow both the course setup and submission procedures..
There is no additional writing component associated with this tutorial, so the Documents
subdirectory can be omitted.
This is worth 6% of your final grade and is due whenever Canvas says it is due. (This is most likely Wednesday, January 11.)
Again, you must strictly follow both the course setup and submission procedures..
There is no additional writing component associated with this tutorial, so the Documents
subdirectory can be omitted.
Be aware that updates to Unity have changed the way some of this code must be written since the publication of Introduction to Game Design, Prototyping, and Development. Please see the IGDPD website for some errata. And here's some more:
Application.LoadLevel(...)
Unity has deprecated Application.LoadLevel(...)
. In any files where the function is required by the book, instead:
using UnityEngine.SceneManagement;
directive is present near the top of the file.Application.LoadLevel(...)
with SceneManager.LoadScene(...)
.Directional Light
sIt seems like Unity automatically generates a Directional Light
for each scene, so when the book tells you to create a new one, edit the existing one instead.
GUIText
Unity has made some major changes to their GUI (Graphical User Interface). A redesign of the Create
menu now makes it more challenging to create the old GUI elements. Anywhere that the text asks you to choose GameObject -> Create Other -> GUIText
from the menu bar, instead:
GameObject -> Create Empty
.Component -> Rendering -> GUIText
.With powerUpDropChance = 1f
, once your ship is fully upgraded it becomes very likely that an enemy will be hit by multiple projectiles in the frame of its destruction. You don't want an enemy to ever drop more than one power-up, so add a bit of code:
GameObject other = coll.gameObject; // Prevent additional projectiles from causing a destroyed ship to fire additional on-destruction triggers if (health <= 0) { Destroy(other); //< Otherwise, extra shots that strike are never destroyed and float in space indefinitely return; } switch(other.tag)
The settings for the Capsule Collider for Wing_L
seem to be incorrect. Try:
Center: [0,0,0] Radius: 0.5 Height: 1 Direction: X-Axis
prefabEnemies
Be sure to add one of each enemy to prefabEnemies
before you turn in your projects to make it easier for us to see that you've implemented all of the enemies in Space SHMUP.
Likewise, set power-up drop rates high enough to make power-ups common.
Here are some additional thoughts that might help you while going through the tutorials.
In Unity, you need to view things from the back to have positive x
pointing to the right.
SceneManager.LoadScene(...)
is called.This is only an issue in the editor. It will not affect your final builds. It's a bug in continuous baking.
return ...
Jeremy routinely treats return ...
as if it were a function, return(...)
. Since it is not a function, I suggest omitting the parentheses.
... as GameObject
Jeremy routinely casts return values for some functions to GameObject even though this appears to be unnecessary. Perhaps it was in a prior version of Unity, but you can generally omit the casts as you go through the tutorials.
There are three kinds of comments in the tutorial code:
Great explanatory comments, like you should write in your code:
// This function will iteratively climb up the transform.parent tree // until it either find a parent with a tag != "Untagged" or no parent public static GameObject FindTaggedParent(GameObject go) {...}
See how it explains in more detail what FindTaggedParent(...)
should actually do? Do this.
Great tutorial comments, which you don't need to write yourselves:
// Check to make sure that the key exists in the Dictionary // Attempting to retrieve a key that didn't exist, would throw an error, // so the following if statement is important. if (W_DEFS.ContainsKey(wt)) return W_DEFS[wt];
See how it informs you that it's written this way to avoid throwing an exception. This also allows you to realize you could write it try/catch style.
Superfluous comments, which needn't be written:
if (u>=1) { // if u >=1...
These provide no information. Please don't write them in your code. They're distracting at best.
The singleton pattern should ensure several things:
What Jeremy calls a singleton is actually just a global variable. For real C# singleton implementations, I recommend reading C# in Depth: Implementing the Singleton Pattern in C#
They're unfortunately not legal for anything derived from MonoBehaviour
. On the plus side, MonoBehaviour
provides guarantees #2 and #3 for you on its own. Presumably multiple instances of the same script being attached to different objects will cause you problems. (i.e. #1 appears to be unsolvable.)
#4 is solveable however. Jeremy's version leaves the static instance variable unprotected. That is fixable without refactoring global data into classes that can be made into actual Singletons:
static private ThisType instance; // Singleton static public ThisType S { get { return instance; } } void Awake() { instance = this; // Set the Singleton }
If you need multiple instances of such a script across the lifetime of your game, I haven't investigated what will happen using this pseudosingleton. I suggest using actual Singleton implementations to provide access to global data where possible.
When you get to Jeremy's introduction to delegates, I suggest additionally reading C# in Depth: Delegates and Events to see how to avoid exposing public delegates. I want you to care more about encapsulation. It'll help you avoid a lot of pitfalls.
The aspect ratios expected by these tutorials (particularly by Space SHMUP) are a little strange. Most computers will not support them. If you want to enforce the correct aspect ratios, you have permission to use the code snippet from Controlling Aspect Ratio in Unity for this assignment and for future assignments.
There are some steps you should take care of before getting deep into your project:
git
(Git) is accessible from the commandline.Note: If you choose to use Brew to install Keka, make sure you use brew install Caskroom/cask/keka
.
.git/
directory should exist in the root of your Unity project.)Documents/
subdirectory within your Git repo and plan to store any written deliverables of the assignment there. (Keep anything we haven't explicitly requested out of there.)From time to time, you should additionally
File -> Build Settings...
and that the checkboxes for them are checked.Be aware of the naming convention for the given assignment:
eecs-494-w17-t1_uniqname
eecs-494-w17-t2_uniqname
eecs-494-w17-p1_uniqname_uniqnamf
eecs-494-w17-p2_uniqname_uniqnamf
eecs-494-w17-p3_uniqname
eecs-494-w17-p4_uniqname_uniqnamf_uniqnamg_uniqnamh
Please do as follows:
.app
bundle for Mac OS X and the .exe
for Windows following the above naming convention.eecs-494-f16-p1_uniqname_uniqnamf-private.7z
should be built in your repository. It should contain eecs-494-f16-p1_uniqname_uniqnamf.app/
, eecs-494-f16-p1_uniqname_uniqnamf_Data/
, eecs-494-f16-p1_uniqname_uniqnamf_Repo/
, and eecs-494-f16-p1_uniqname_uniqnamf.exe
..7z
file built by the script directly to Canvas or, if absolutely necessary, provide a link and the SHA256 sum generated at the end of the script as part of your submission.Documents/
or which include only links (such as .gdoc
redirects) instead of required exports will not get credit for those deliverables. You will get a 0 for them.Late assignments will be assessed a penalty of 2.5% for each 6 hours it is late (10% per day) up until the cutoff. We will not grant extensions except for extended sicknesses.
The class forum is available through the Canvas Piazza and is by far the best place to ask questions.