28 lines
678 B
C#
28 lines
678 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class tpBack : MonoBehaviour
|
||
|
|
{
|
||
|
|
public Transform max;
|
||
|
|
public Transform min;
|
||
|
|
public Transform Back;
|
||
|
|
public RectTransform parent;
|
||
|
|
// Start is called before the first frame update
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
{
|
||
|
|
if (transform.position.x > max.position.x || transform.position.x < min.position.x)
|
||
|
|
{
|
||
|
|
transform.position = new Vector3(Back.position.x , transform.position.y , transform.position.z );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|