Guest User

Untitled

a guest
Mar 19th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class DoorScript : MonoBehaviour {
  5.  
  6. public bool open = false;
  7. public float smooth = 2f;
  8.  
  9. void Start ()
  10. {
  11.  
  12. }
  13.  
  14.  
  15. public void ChangeDoorState()
  16. {
  17. open = !open;
  18. GetComponent<AudioSource>().Play ();
  19. }
  20.  
  21. void Update ()
  22. {
  23. if(open) //open == true
  24. {
  25. this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y+10f, this.transform.position.z);
  26. }
  27. else
  28. {
  29. this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y-10f, this.transform.position.z);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment