Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ObjectRaisingScript : MonoBehaviour {
  5.  
  6. public float tranformY = -100.0f;
  7. public float proximityToPlayerX = 40.0f;
  8. public float proximityToPlayerZ = 40.0f;
  9. public int speedOfFadeIn = 100;
  10. public GameObject target;
  11. private bool isActive = false;
  12.  
  13. // Use this for initialization
  14. void Start ()
  15. {
  16. transform.position += new Vector3(0.0f, tranformY, 0.0f);
  17. }
  18.  
  19. // Update is called once per frame
  20. void Update ()
  21. {
  22. if(isActive == false
  23. && (Mathf.Abs (target.GetComponent<Transform>().position.x - transform.position.x) < proximityToPlayerX
  24. && Mathf.Abs (target.GetComponent<Transform>().position.z - transform.position.z) < proximityToPlayerZ))
  25. {
  26. isActive = true;
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement