Skip to content

Instantly share code, notes, and snippets.

@jakevsrobots
Created February 9, 2012 18:16
Show Gist options
  • Save jakevsrobots/1781746 to your computer and use it in GitHub Desktop.
Save jakevsrobots/1781746 to your computer and use it in GitHub Desktop.
#pragma strict
#pragma downcast
class SpeakingCharacter extends MonoBehaviour {
// ------------------------------------------
// Properties
// ------------------------------------------
public var characterName : String;
public var conversationXMLFile : TextAsset;
// ------------------------------------------
// Unity callbacks
// ------------------------------------------
public function Start() : void {
if(conversationXMLFile == null || characterName == null) {
throw "The SpeakingCharacter object " + gameObject.name + " is missing a conversation file or character name.";
}
//StageManager.RegisterComponent(this, GameState.exploring);
}
// Just for testing, probably:
public function OnMouseUp() : void {
// So, only Update() and OnGUI() care about 'MonoBehaviour.enabled' I guess
if(this.enabled) {
StartConversation();
}
}
// ------------------------------------------
// Private methods
// ------------------------------------------
private function StartConversation():void {
StageManager.StartConversationWithCharacter(gameObject);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment