24 lines
615 B
C#
24 lines
615 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Unity.Collections;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UIElements;
|
||
|
|
|
||
|
|
public class TPBlock : MonoBehaviour
|
||
|
|
{
|
||
|
|
public GameObject SecondTeleport;
|
||
|
|
public GameObject Player;
|
||
|
|
|
||
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
||
|
|
{
|
||
|
|
Vector3 tpPos = SecondTeleport.transform.position;
|
||
|
|
if (collision.tag == "Player")
|
||
|
|
{
|
||
|
|
Player = collision.gameObject;
|
||
|
|
Player.transform.position = tpPos;
|
||
|
|
GameObject.Find("BodyPlayer").transform.position = tpPos;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|