您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

40 行
1.0 KiB

using System.Collections.Generic;
using UnityEngine;
[DisallowMultipleComponent]
[ServerOnlyComponent]
public class TeleporterServer : MonoBehaviour
{
public TeleporterServer targetTeleporter;
public Vector3 spawnPosition;
public SpatialEffectTypeDefinition effect;
[System.NonSerialized]
public HitCollision characterInside;
void OnTriggerStay(Collider c)
{
// System is responsible for removing characters
if(characterInside == null)
characterInside = c.gameObject.GetComponent<HitCollision>();
}
public Vector3 GetSpawnPositionWorld()
{
return transform.TransformPoint(spawnPosition);
}
public Quaternion GetSpawnRotationWorld()
{
var q = Quaternion.identity;
q.SetLookRotation(transform.TransformDirection(spawnPosition.normalized));
return q;
}
#if UNITY_EDITOR
void OnDrawGizmos()
{
Gizmos.DrawCube(transform.TransformPoint(spawnPosition) + Vector3.up * 0.10f, Vector3.one * 0.2f);
}
#endif
}