Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class DoorScript : MonoBehaviour {
- public bool open = false;
- public float smooth = 2f;
- void Start ()
- {
- }
- public void ChangeDoorState()
- {
- open = !open;
- GetComponent<AudioSource>().Play ();
- }
- void Update ()
- {
- if(open) //open == true
- {
- this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y+10f, this.transform.position.z);
- }
- else
- {
- this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y-10f, this.transform.position.z);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment