Archive for October, 2010

Unity Penelope Tutorial update for Unity 3 and C# – Part 2, Pages 37-71


Need Part 1?

Wow, I didn’t realize that part 2 would involve writing so much code. The tap control piece was much longer than I had expected, and even now the zoom in feels much faster than the zoom out so I might have a small error some where.

I also had to rewrite the ZoomCamera JS to C# because the TapControl had a code reference to the class and I didn’t realize that you couldn’t have mismatching code classes reference each other, not that I am that surprised that it was a problem when it arose either mind you… maybe I imagined unity was so magical that it wouldn’t be an issue. ^_~

Part 2 converts all three control types into c# along with 2 other classes:

I did run into a few small errors in the tutorial, and I made notes by them above their respected snippet or as a comment in the code. Enjoy.
Read more »

Unity Penelope Tutorial update for Unity 3 and C# – Part 1, Pages 19-33


I like to get familiar with Unity3d v3, mobile device development, and c#.

MonoDevelop is a great tool for developing Unity 3. It has excellent code completion and line by line debugging. Unfortunately it doesn’t support UnityScript/JavaScript for code completion, so I decided to suck it up and just force myself to go with C#.

Being unfamiliar with Unity development as a whole, I found the Penelope Tutorial fantastic. It is written using the old unity api and with UnityScript. I figured, since I’m going to be going though the tutorial and converting everything to C# and the Unity 3 API I might as make the coding snippets though out the tutorial available as well.
Here is the first part: pages 19 – 33 of the Penelope PDF converted to c# and using the latest Unity 3 API

Read more »

Pause Timer for AS3


Pause Timer SourceExample Source

EDIT 05/07/2012:  Made a small changed so getting pausetimer.delay return the initially set delay vs the super.timer delay.  When paused, the pausetimer will update the super.timer delay for the current interval after which it sets it back to the originally set delay.  If you were trying to get the delay before the update, you were seeing this short delay.  The change is outlined here.

Recently I wanted to add a pause function in another tool that I’ll be posting up on here in the future ^_~

Timers were the backbone of the sequencing the tool used and I was pretty surprised to find a lack of pausing ability in the native AS3 Timers.  I looked around to see if anybody had remedied this problem, and Lewinzki did.

The solution was there but I had a few issues with the implementation:

I didn’t like that the delay wouldn’t be reset back to the userset delay (or user updated value) after it had been paused. Basically the timer ticks will be messed up if you didn’t reset the delay back to userset value every tick.

Also if you wanted to attach events to the timer, you actually had to step into the object and listen to the child timer in Lewinzki’s timer.

Other than those two qualms it was sound.  I decided to rewrite it extending the native Timer so its would function exactly the same with the added pause and resume features, though calling start when paused will also just resume as well.
Read more »