blob: 193c632b0f1ed5fc19b58d53d99025753cbcc11b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
using UnityEngine;
public class TeleportToOpponent : MonoBehaviour
{
public float time = 0.5f;
public ParticleSystem from;
public ParticleSystem to;
private Player target;
private void Start()
{
}
public void Go()
{
if (!target)
{
target = PlayerManager.instance.GetOtherPlayer(GetComponentInParent<Player>());
}
from.Play();
base.transform.root.transform.position = target.transform.position + (target.transform.position - base.transform.position).normalized;
to.Play();
}
}
|