Skip to content

Instantly share code, notes, and snippets.

@nasser
Created February 27, 2015 02:34
Show Gist options
  • Save nasser/52094a44562b7b68bc5d to your computer and use it in GitHub Desktop.
Save nasser/52094a44562b7b68bc5d to your computer and use it in GitHub Desktop.
var cubeToMove : CubeMover;
function Start() {
cubeToMove = GameObject.Find("Mover").GetComponent(CubeMover);
}
function OnMouseDown () {
transform.localScale.y = 0.2;
cubeToMove.Move();
cubeToMove.speed -= 0.1;
// Debug.Log( );
}
function OnMouseUp () {
transform.localScale.y = 0.6;
}
function OnMouseDrag () {
SendMessage("Move", SendMessageOptions.DontRequireReceiver);
}
var speed : float = 5;
function Move () {
transform.Translate(0, speed * Time.deltaTime, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment