topical media & game development

talk show tell print

lib-unity-experiment-bezier-Assets-Scripts-MoveTest.js / js



  var controlPoints : Transform[];
  var controlPointArray : Array = new Array();
  var style : GUIStyle;
  private var activated : boolean;
  
  function Start(){
          activated=true;
          for(var i : int; i<controlPoints.length; i++){
                  controlPointArray.Push(controlPoints[i].position);
          }
  }
  
  function OnGUI () {
          if(activated){
                  if(GUI.Button (Rect (97,137,113,32), "",style)){
                          transform.localPosition=Vector3(-4,0,0);
                          transform.localRotation=Quaternion.Euler(0,90,0);
                          activated=false;
                          tween();
                  }
          }
  }
  
  function tween(){
          iTween.moveToBezier(gameObject,{"time":5,"bezier":controlPointArray,"transition":"linear","onComplete":"complete"});
  }
  
  function complete(){
          activated=true;        
  }
  


(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.