topical media & game development

talk show tell print

lib-unity-book-06-CoconutWin.js / js



  /* Script Provided by Will Goldstone as part of Unity Game Development Essentials book assets */
  /* Please Do Not Remove this comment - this script is for reference only */
  
  static var targets : int = 0;
  private var haveWon : boolean = false;
  var win : AudioClip;
  var battery : GameObject;
  
  function Update () {
  
          if(targets==3 && haveWon == false){
                  targets=0;
                  audio.PlayOneShot(win);
                  var lastBattery : GameObject = Instantiate(battery, Vector3(transform.position.x, transform.position.y+2, transform.position.z), transform.rotation);
                  haveWon = true;
          }
  }
  
  @script RequireComponent(AudioSource)


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