Friday, 15 March 2013

Shelf Door Code

var ShelfDoor:GameObject;
var isOpen;

function OnMouseDown()
{

      if(!this.isOpen){
      ShelfDoor.animation.Play("ShelfDoorOpen");
      this.isOpen = true;
}
else
{

       ShelfDoor.animation.Play("ShelfDoorClose");
       this.isOpen = false;

   }
}

This is the code Alistair and I have used to get the shelf doors to open on one click, and close on another click.

No comments:

Post a Comment