Skip to content

Instantly share code, notes, and snippets.

@MattRix
Created June 6, 2013 20:40
Show Gist options
  • Save MattRix/5724757 to your computer and use it in GitHub Desktop.
Save MattRix/5724757 to your computer and use it in GitHub Desktop.
An alternative to enums. This is a response to this post: http://www.gamasutra.com/view/feature/193616/advanced_audio_streaming_in_unity.php?page=3
using System;
using System.Collections.Generic;
public class AudioClipType
{
static public List<AudioClipType> allAudioClipTypes = new List<AudioClipType>();
static public AudioClipType SnakeEat = new AudioClipType("snake_eat","wav",1.0f);
static public AudioClipType UIPress = new AudioClipType("ui_press","wav",1.0f);
static public AudioClipType Explosion = new AudioClipType("explosion","wav",1.0f);
static public AudioClipType GameOver = new AudioClipType("game_over","wav",1.0f);
static public AudioClipType LevelUp = new AudioClipType("level_up","wav",1.0f);
static public AudioClipType StartGame = new AudioClipType("start_game","wav",1.0f);
static public AudioClipType PauseClick = new AudioClipType("pause_click","wav",1.0f);
static public AudioClipType PlayButton = new AudioClipType("play_button","ogg",1.0f)
public string name;
public string fileType;
public float volume;
public int priority;
public AudioClipType(string name, string fileType, float volume)
{
this.name = name;
this.fileType = fileType;
this.volume = volume;
this.priority = allAudioClipTypes.Count;
allAudioClipTypes.Add(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment