topical media & game development
lib-unity-experiment-tween-Assets-callback.js / js
private var tweenTarget : GameObject;
var counter : GUIText;
var count : int =0;
function Start(){
tweenTarget=gameObject;
roll("right");
counter.guiText.material.color = Color.black;
Application.ExternalCall( "jsfun", "The game says hello!" );
}
private function roll(direction: String): void{
switch(direction){
case "right":
iTween.rotateBy(tweenTarget,{"z":-.5});
iTween.moveTo(tweenTarget,{"x":1.7, "onComplete":"roll", "onCompleteParams":"left"});
count+=1;
break;
case "left":
iTween.rotateBy(tweenTarget,{"z":1});
iTween.moveTo(tweenTarget,{"x":-1.7, "onComplete":"roll", "onCompleteParams":"right"});
count+=1;
break;
}
counter.text=count.ToString() + " Loops";
//Application.ExternalCall( "jsfun", count.ToString + " " tweenTarget.transform.ToString());
Application.ExternalCall( "jsfun", tweenTarget.transform.position.x );
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.