Radio channels simulation: Unity scripting with C#

We learned C# scripting basics for Unity and a quick exercise in class was to develop a radio scene that plays new audio clip on keypress. I created the scene with an Audio Source gameobject, and assigned a script called radioChannelSwitch to it. The gameobject looks like this:


Audio Source gameobject has an array of audio clips called My clips. I defined the size and contents of this array with Unity GUI by dragging and dropping those 5 audio files from project assets to Element 0-4 fields.

AudioClip on top refers to file STE-015, which is 0th element of My clips array. When triggered, Audio Source plays the file that’s currently pointed by AudioClip. So a keypress (Space bar in this case) needs to switch AudioClip to point to next file (or Element) from My clips array.

The script radioChannelSwitch.cs looks like this:

using UnityEngine;
using System.Collections;

public class radioChannelSwitch : MonoBehaviour {

    public AudioClip [] myClips;
    private int currentClip;

    // Use this for initialization
    void Start () {
        GetComponent<AudioSource> ().clip = myClips [0];
         // initialize Audio Clip to 0th clip from the array

    // Update is called once per frame
    void Update () {
        if (Input.GetKeyDown(KeyCode.Space))
            Debug.Log (Updated+ currentClip);
            GetComponent<AudioSource> ().clip myClips[currentClip];
            GetComponent<AudioSource> ().Play ();
            if (currentClip == myClips.Length)
                currentClip = 0;



Automated carpool app

I applied many of the learnings from Alon’s class and made this video using Aftereffects:

Chalking down the idea, sequence of frames, sketching the whole 30 seconds took nearly 70% of the time. I wanted this video to convey a number of problems, possible solution, & perks of using this solution. I first did some sketching to finalize the frames and graphic elements that I then created using Illustrator.