Skip to content

Instantly share code, notes, and snippets.

@lucasmeijer
Created June 17, 2011 10:47
Show Gist options
  • Save lucasmeijer/1031201 to your computer and use it in GitHub Desktop.
Save lucasmeijer/1031201 to your computer and use it in GitHub Desktop.
package UnityEngine {
import System.Enum;
public final class SubstanceType extends Enum {
public static const Boolean: SubstanceType = new SubstanceType("Boolean", 0);
public static const Float: SubstanceType = new SubstanceType("Float", 1);
public static const Vector2: SubstanceType = new SubstanceType("Vector2", 2);
public static const Vector3: SubstanceType = new SubstanceType("Vector3", 3);
public static const Vector4: SubstanceType = new SubstanceType("Vector4", 4);
public static const Color3: SubstanceType = new SubstanceType("Color3", 5);
public static const Color4: SubstanceType = new SubstanceType("Color4", 6);
public static const Enum: SubstanceType = new SubstanceType("Enum", 7);
public static const Texture: SubstanceType = new SubstanceType("Texture", 8);
public static function ValueOf(value: int): SubstanceType {
switch (value) {
case 0: return SubstanceType.Boolean;
case 1: return SubstanceType.Float;
case 2: return SubstanceType.Vector2;
case 3: return SubstanceType.Vector3;
case 4: return SubstanceType.Vector4;
case 5: return SubstanceType.Color3;
case 6: return SubstanceType.Color4;
case 7: return SubstanceType.Enum;
case 8: return SubstanceType.Texture;
}
throw new RangeError();
}
private static var _initialized: Boolean;
{ _initialized = true; }
function SubstanceType(name: String, value: int) {
super(name, value);
if (_initialized) throw "Use one of: SubstanceType.Boolean, SubstanceType.Float, SubstanceType.Vector2, SubstanceType.Vector3, SubstanceType.Vector4, SubstanceTy$
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment