Why you should use Event Systems

Hello Readers!

So I have received a ton of questions about event systems from both C# classes I teach as well as from Unity game development classes I teach.  So I have decided to build this blog post generically enough to apply to both.  If you aren’t using event systems, your code probably looks a lot like something below…

    /// <summary>
    /// Moves the character on the ladder
    /// </summary>
    /// <param name="position">place touched.</param>
    /// <param name="other">the object that collided with us.</param>
    private void MoveOnLadder(Vector3 position, Collider2D other)
    {
        GameObject profSuite = other.gameObject.transform.parent.gameObject;
        //I used 10 because that is how far the camera is from the scene
        Vector3 worldPos = Camera.main.ScreenToWorldPoint(new Vector3(position.x, position.y, 10));
        Vector2 touchPos = new Vector2(worldPos.x, worldPos.y);
        Collider2D col = Physics2D.OverlapCircle(touchPos, 0.2f, this.whatIsInteractive);
        if (null == col)
        {
            //they didn't touch the ladder, don't move.
            return;
        }
        //double check make sure they didnt cheat and did click on this ladder
        if (col.gameObject.transform.position == this.gameObject.transform.position
            || col.gameObject.transform.position == this.parent.transform.position)
        {
            //move the player to the top
            Vector3 nTansform = profSuite.transform.position;
            nTansform.x = this.top.transform.position.x;
            nTansform.y = this.top.transform.position.y + 5;
            profSuite.transform.position = nTansform;
            profSuite.GetComponent<Rigidbody2D>().AddForce(new Vector2(0.0f, this.HopUpPower));
        }
    }

Continue reading

Develop In the Cloud!

Hello Readers,

This particular article goes out to a few of my students.  I teach C# at a local community college during my Thursday evenings.  One of the things that happens, especially at community colleges, is that you get all sorts of different people from various walks of life.  These walks of life do not always come with laptops with i5 processors and 4gb of ram and 500gb hard drives.  These students only have access to library computers, or computers that are left over from a previous owner that are good for little else than checking email and browsing the internet.  Which in this day and age is perfect for doing hardcore development, but you have to do it in the CLOUD!

alive

Continue reading

Functioning with Tasks, Async, Await and the Core Dispatcher

Hi All,

This Blog article is written for the explicitly purpose of getting functional with Tasks, Async, Await and the Dispatcher.  It will discuss the basics as well as a few more advanced scenarios.  It is not intended in anyway to provide in depth knowledge on any of these topics, it is purely a How-To in 10 minutes Guide written with minimal technical jargon.  The article does however assume some programming knowledge with C# and Xaml.

Continue reading

Intro to XAML Part 2 – Challenge Solution

Hi All,

So this is a solution to the challenge from Windows 8 Introduction to Xaml – Part 2.  Hopefully you were all able to get it in some fashion.  What I am posting below is just a single answer to the problem.  I would not recommend using this solution as a basis for how to code, I broke it out in an attempt to demonstrate each point as best as possible in a way that is conducive to your learning.

Continue reading

Windows 8 Introduction to XAML – Part 2

Hi All,

To start, lets recap what was covered in Part 1.  In Part 1, we discussed what you get out of the box in the Blank App Template from a XAML standpoint.  This included MainPage.xaml, App.xaml, and StandardStyles.xaml as well as how they interact together through extensions.  In this part of the series I will be covering layout, content, controls and some of their properties and attributes.  So start by loading up the Blank App with the single button from the previous part, and lets start there.  Be sure to save your progress as we will be using this App throughout the entirety of the series.

Continue reading

Windows 8 Introduction to XAML – part 1

Hi All,

This particular blog article series aims to get readers understanding XAML on a functional level.  The primary focus will be Layout, Content, Control, Styling, Animation, Resources, a little theory and some code behind.  The assumption I am making of my readers is that you know how to open Visual Studio, create a project and navigate the IDE.  I am gearing this article specifically for people brand new to XAML and C#.

Continue reading