[1Ed] Prototype 5: Bartok
This chapter differs somewhat from the other prototypes because instead of creating an entirely new project, this one shows you how you can build a different game on top of the prototype projects that you’ve developed while reading this book.
Before starting this project, you should have first completed Chapter 31, “Prototype 4: Prospector Solitaire” so that you understand the inner workings of the card game framework developed in that chapter.
Bartok is the game you first encountered in Chapter 1 , “Thinking Like a Designer.” Now you’ll build it yourself.
Errata
- p. 653 – See note below about changes to GUIText in Unity 4.6.
-
There is an overload of the Bezier() function missing from code missing from the version of Utils you used in Prospector that is needed for Bartok. Please add the following code after line 328 of Utils.cs
// The same two functions for Quaternion static public Quaternion Bezier( float u, List<Quaternion> vList ) { // If there is only one element in vList, return it if (vList.Count == 1) { return( vList[0] ); } // Otherwise, create vListR, which is all but the 0th element of vList // e.g. if vList = [0,1,2,3,4] then vListR = [1,2,3,4] List<Quaternion> vListR = vList.GetRange(1, vList.Count-1); // And create vListL, which is all but the last element of vList // e.g. if vList = [0,1,2,3,4] then vListL = [0,1,2,3] List<Quaternion> vListL = vList.GetRange(0, vList.Count-1); // The result is the Slerp of these two shorter Lists // It's possible that Quaternion.Slerp may clamp u to [0..1] :( Quaternion res = Quaternion.Slerp(Bezier(u,vListL), Bezier(u,vListR), u); return( res ); } // This version allows an Array or a series of Quaternions as input static public Quaternion Bezier( float u, params Quaternion[] vecs ) { return( Bezier( u, new List<Quaternion>(vecs) ) ); }
Alternatively, you can replace your Utils.cs file from the Prospector build with the one below.