public void OnStart(BasePlayer target) { //保存实例对象 m_basePlayer = target; //设置跟随目标 UIPlayerInfos.FollowTarget(gameObject, target); }
public static UIPlayerInfos FollowTarget(GameObject owner, BasePlayer target) { if (null == owner || null == target) { Debug.LogError("Input parameter illegal"); return(null); } UIPlayerInfos ft = owner.GetOrAddComponent <UIPlayerInfos>(); ft.m_sBasePlayer = target; return(ft); }