Skip to content

Lecture 3 – Class Cancelled. Project Is Now Assignment.

Here is the starter project for the assignment.  The source file you need to change is AIBehavior.cs.  To change a specific actor’s behavior:

  1. select that actor in the heirarchy view
  2. go to the Actor script
  3. change  ”Desired Behavior” to either “Seek”, “Flee”, “Arrive”, “Wander” or “Align”
  4. if you have “Wander” make sure “Face Where You Are Going” is unchecked.

The minimum behaviors you have to implement are Seek, Flee and Arrive.  Wander and Align are both extra credit.

The Assignment is due prior to class next week(By 6PM 2/16/10). Collaboration is allowed…. However you need to indicate who you collaborated with.  Stating that in the assignment submission email is fine.

Ways to submit:

  • zip up the project directory and email it to me  (That is Lecture3Incomplete/ folder)
  • if you only modified AIBehavior.cs you can zip that and email it to me… I will put it in my own project and run it.

Hints:

Look at the textbook and the code that is from the textbook’s website!!!!

The most you have to change/add per behavior is a 2-4 lines. If you find yourself typing more than 5 lines for a behavior you are doing more than is necessary.  However I won’t penalize you for have more lines than necessary.  If the behavior works and doesn’t crash a lot you will get full credit.

Remember that the Function GetOrientationAsVector(float) is a static function. That mean you just put the Class Name in front of it not an instance(a variable you created). So to call it you type:

Vector3 orientationVector = Actor.GetOrientationAsVector(currentActorOrientation);

“Actor” in this case acts like the math classes in unity…. Mathf.Sin() calls the Sine function on the Mathf class without instantiating a Math class. Actor is the same way in this case.

Post a Comment

You must be logged in to post a comment.