@@ -67,6 +67,143 @@ <h1>Changelog for Unity Plugin</h1>
6767 < div class ="row ">
6868 < div class ="col-sm-8 lesson-main ">
6969 < ul >
70+ < li > < p > 1.2</ p >
71+ < ul >
72+ < li > < p > Added Export/Install/Publish menu items</ p >
73+ </ li >
74+ < li > < p > added HFTGamepad.BUTTON_TOUCH for whether or not the user is touching the screen
75+ on the orientation and touch controllers.</ p >
76+ </ li >
77+ < li > < p > added ability to play sound through controller</ p >
78+ < p > There are currently 2 ways to make sounds for the controllers.</ p >
79+ < ol >
80+ < li > < p > JSFX</ p >
81+ < p > This is the recommended way as it's light weight.</ p >
82+ < ol >
83+ < li > < p > Go to the < a href ="http://egonelbre.com/project/jsfx/ "> JSFX sound maker</ a > .</ p >
84+ </ li >
85+ < li > < p > Adjust the values until you get a sound you like.</ p >
86+ </ li >
87+ < li > < p > Copy the sound values (near top of the page just below the buttons) to a text file with the extension ".jsfx.txt"
88+ putting a name in front of each set of values. Save that file in Assets/WebPlayerTemplates/HappyFunTimes</ p >
89+ </ li >
90+ </ ol >
91+ < p > For example here is the sample < code > sounds.jsfx.txt</ code > file</ p >
92+ < pre > < code > coin ["square",0.0000,0.4000,0.0000,0.0240,0.4080,0.3480,20.0000,909.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.2540,0.1090,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
93+ jump ["square",0.0000,0.4000,0.0000,0.0960,0.0000,0.1720,20.0000,245.0000,2400.0000,0.3500,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.5000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
94+ coinland ["square",0.0000,0.4000,0.0000,0.0520,0.3870,0.1160,20.0000,1050.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
95+ bonkhead ["sine",0.0000,0.4000,0.0000,0.0000,0.5070,0.1400,20.0000,1029.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
96+ land ["sine",0.0000,0.4000,0.0000,0.1960,0.0000,0.1740,20.0000,1012.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
97+ kicked ["noise",0.0000,1.0000,0.0000,0.0400,0.0000,0.2320,20.0000,822.0000,2400.0000,-0.6960,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0270,0.0000]
98+ dropkick ["sine",0.0000,1.0000,0.0000,0.0880,0.0000,0.3680,20.0000,653.0000,2400.0000,0.2360,0.0000,0.1390,47.1842,0.9623,-0.4280,0.0000,0.0000,0.4725,0.0000,0.0000,-0.0060,-0.0260,1.0000,0.0000,0.0000,0.0000,0.0000]
99+ bounce ["noise",0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
100+ </ code > </ pre > </ li >
101+ < li > < p > Use sounds files</ p >
102+ < p > Put sound files (< code > .mp3</ code > or < code > .wav</ code > ) in < code > Assets/WebPlayerTemplates/HappyFunTimes/sounds</ code >
103+ They have to be in there because they must be served to the phone. Note that it's a
104+ good idea to keep them as small as possible because each time a player connects to
105+ the game his phone will have to download all the sounds. JSFX sounds comming soon.</ p >
106+ </ li >
107+ </ ol >
108+ < h2 id ="playing-sounds "> Playing Sounds</ h2 >
109+ < p > To use the sounds, on some global gameobject (like LevelManager in all the samples)
110+ add an < code > HFTGlobalSoundHelper</ code > script component.</ p >
111+ < p > Then, on the prefab that gets spawned for your players, the same prefab you put
112+ an < code > HFTInput</ code > or < code > HFTGamepad</ code > script component add the < code > HFTSoundPlayer</ code > script
113+ component.</ p >
114+ < p > In your < code > Awake</ code > or < code > Start</ code > look it up</ p >
115+ < pre > < code > private HFTSoundPlayer m_soundPlayer;
116+
117+ void Awake()
118+ {
119+ m_soundPlayer = GetComponent<HFTSoundPlayer>();
120+ }
121+ </ code > </ pre > < p > To play a sound call < code > m_soundPlayer.PlaySound</ code > with the name of the sound (no extension).
122+ In other words if you have < code > sounds/explosion.mp3</ code > then you can trigger that sound on
123+ the user's phone with</ p >
124+ < pre > < code > m_soundPlayer.PlaySound("explosion");
125+ </ code > </ pre > < p > Or if you named a JSFX sound like</ p >
126+ < pre > < code > bounce ["noise",0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
127+ </ code > </ pre > < p > Then</ p >
128+ < pre > < code > m_soundPlayer.PlaySound("bounce");
129+ </ code > </ pre > </ li >
130+ </ ul >
131+ </ li >
132+ </ ul >
133+ < pre > < code > * added mulit-touch support to HFTInput via the standard `GetTouch` function
134+ as well as `axes` and `buttons`
135+
136+ public const int AXIS_TOUCH0_X = 13;
137+ public const int AXIS_TOUCH0_Y = 14;
138+ public const int AXIS_TOUCH1_X = 15;
139+ public const int AXIS_TOUCH1_Y = 16;
140+ public const int AXIS_TOUCH2_X = 17;
141+ public const int AXIS_TOUCH2_Y = 18;
142+ public const int AXIS_TOUCH3_X = 19;
143+ public const int AXIS_TOUCH3_Y = 20;
144+ public const int AXIS_TOUCH4_X = 21;
145+ public const int AXIS_TOUCH4_Y = 22;
146+ public const int AXIS_TOUCH5_X = 23;
147+ public const int AXIS_TOUCH5_Y = 24;
148+ public const int AXIS_TOUCH6_X = 25;
149+ public const int AXIS_TOUCH6_Y = 26;
150+ public const int AXIS_TOUCH7_X = 27;
151+ public const int AXIS_TOUCH7_Y = 28;
152+ public const int AXIS_TOUCH8_X = 29;
153+ public const int AXIS_TOUCH8_Y = 30;
154+ public const int AXIS_TOUCH9_X = 31;
155+ public const int AXIS_TOUCH9_Y = 32;
156+
157+ public const int BUTTON_TOUCH0 = 18;
158+ public const int BUTTON_TOUCH1 = 19;
159+ public const int BUTTON_TOUCH2 = 20;
160+ public const int BUTTON_TOUCH3 = 21;
161+ public const int BUTTON_TOUCH4 = 22;
162+ public const int BUTTON_TOUCH5 = 23;
163+ public const int BUTTON_TOUCH6 = 24;
164+ public const int BUTTON_TOUCH7 = 25;
165+ public const int BUTTON_TOUCH8 = 26;
166+ public const int BUTTON_TOUCH9 = 27;
167+
168+ Note: The Touch.rawPosition is currently in screen pixels of Unity
169+ not the controller. It's not clear what the best way to handle this
170+ is.
171+
172+ The Unity `Input` API says those value are in pixels but they are
173+ assuming the game is running on the phone. In the case of HappyFunTimes
174+ though each phone is different so having it be in phone screen pixels
175+ would make no sense unless you also knew the resolution of each phone.
176+ I could provide that but that would make it more complicated for you.
177+
178+ Personally I'd prefer normalized values (0.0 to 1.0). If you want those
179+ then take `Touch.rawPosition` and divide `x` by `Screen.width` and `y` by `Screen.height`
180+ as in
181+
182+ HFTInput.Touch touch = m_hftInput.GetTouch(0);
183+ float normalizedX = touch.x / Screen.width;
184+ float normalziedY = touch.y / Screen.height;
185+
186+ Also note the AXIS versions of these are already normalized to
187+ a -1.0 to +1.0 range.
188+
189+ * Changed sample HFTGamepad code to not issue an error if it's not actually
190+ connected to a controller.
191+
192+ Users often leave a prefab in their scene. That prefab would generate
193+ errors because it's not actually connected to a controller and was
194+ trying to access the controllers `NetPlayer`.
195+ </ code > </ pre > < ul >
196+ < li > < p > 1.1</ p >
197+ < ul >
198+ < li > Moved samples into samples folder</ li >
199+ </ ul >
200+ </ li >
201+ < li > < p > 1.0</ p >
202+ < ul >
203+ < li > made the plugin based on < a href ="http://github.com/greggman/hft-unity-gamepad "> hft-unity-gamepad</ a >
204+ that implements 12 controllers.</ li >
205+ </ ul >
206+ </ li >
70207< li > < p > 0.0.7</ p >
71208< ul >
72209< li > Added < code > maxPlayers</ code > to PlayerSpawner</ li >
0 commit comments