您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
17 行
355 B
17 行
355 B
using UnityEngine;
|
|
|
|
public class ChaseComponent : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform _target = default;
|
|
[SerializeField] private float _speed = 10f;
|
|
|
|
public Transform Target => _target;
|
|
|
|
public void Chase()
|
|
{
|
|
transform.position = Vector3.MoveTowards(
|
|
transform.position,
|
|
_target.position,
|
|
_speed * Time.deltaTime);
|
|
}
|
|
}
|