Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DestroyBox : MonoBehaviour, IGvrPointerHoverHandler {
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- }
- void Destroy()
- {
- Destroy(this.gameObject);
- }
- public void OnGvrPointerHover(PointerEventData eventData)
- {
- Destroy();
- }
- }
- ------------------------------------------
- public Transform Player;
- int MoveSpeed = 1;
- int MaxDist = 1000;
- int MinDist = 0;
- float time = 5.0f;
- void Start()
- {
- }
- void Update()
- {
- if (time >= 0)
- {
- time -= Time.deltaTime;
- return;
- }
- else
- {
- transform.LookAt(Player);
- if (Vector3.Distance(transform.position, Player.position) >= MinDist)
- {
- transform.position += transform.forward * MoveSpeed * Time.deltaTime;
- if (Vector3.Distance(transform.position, Player.position) <= MaxDist)
- {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement