Skip to content

Instantly share code, notes, and snippets.

@lucasmeijer
Created April 6, 2011 08:41
Show Gist options
  • Save lucasmeijer/905342 to your computer and use it in GitHub Desktop.
Save lucasmeijer/905342 to your computer and use it in GitHub Desktop.
package {
import UnityEngine.MonoBehaviour;
import UnityEngine.Debug;
import UnityEngine.Vector3;
import UnityEngine.Time;
import UnityEngine.Serialization.IDeserializable;
import UnityEngine.Serialization.SerializedStateReader;
public class NewBehaviourScript extends MonoBehaviour implements IDeserializable {
public var speed: int;
public var myfloat: Number;
public var mystring: String;
public var anotherstring: String;
public function Start(): void {
Debug.Log("speed");
Debug.Log(this.speed);
Debug.Log("float:");
var num: int = (this.myfloat as int);
Debug.Log(num);
Debug.Log("string:");
Debug.Log(this.mystring);
Debug.Log("anotherstring:");
Debug.Log(this.anotherstring);
}
public function Update(): void {
super.transform.RotateAround(Vector3.up, Time.deltaTime * (this.speed as Number));
}
public function Deserialize(reader: SerializedStateReader): void {
this.speed = reader.ReadInt();
this.myfloat = reader.ReadFloat();
this.mystring = reader.ReadString();
this.anotherstring = reader.ReadString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment