using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Follow : MonoBehaviour
{
[Header("所有跟踪单位")]
public List<Transform> Followers=new List<Transform>();
public static List<Transform> S_Followers=new List<Transform>();
[Header("头部")] public Transform Head;
[Header("间隔")] public int Space=0;
public static int S_Space;
[Tooltip("保存坐标")]public static Vector3[] SaveV3=new Vector3[500];
[Tooltip("保存头部坐标")] Vector3 SavingHead;
#region 测试用记得删
public Transform TestAdd, TestRemove;
public bool Testing;
#endregion
private void OnEnable()
{
S_Followers = Followers;
S_Space = Space;
#region 案例:增删跟随者
StartCoroutine(Changer());
IEnumerator Changer()
{
yield return new WaitForS
Unity角色跟随
最新推荐文章于 2024-09-12 01:30:02 发布
这篇博客详细探讨了在Unity引擎中如何实现游戏角色的智能跟随机制,包括路径规划、寻路算法和运动控制器的设置,旨在创建出更加真实的游戏体验。
摘要由CSDN通过智能技术生成