public void Follow(Transform trans) { if (!isFollowing && null != trans) { isFollowing = true; Follow3DBy2D.FollowTrans(itemGo, trans, Vector3.zero); } }
public Transform AddBar(int ownerId, Vector3 pos) { GameObject bar = CreateBar(); Follow3DBy2D.FollowPos(bar, pos); bars.Add(ownerId, bar); return(bar.transform); }
public static void StopFollower(GameObject follower) { Follow3DBy2D comp = follower.GetComponent <Follow3DBy2D>(); if (null != comp) { comp.StopFollow(); } }
public void BarChangeFollower(int ownerId, Transform followTrans) { if (bars.ContainsKey(ownerId)) { GameObject bar = bars[ownerId]; if (null != bar) { Follow3DBy2D.FollowTrans(bar, followTrans, Vector3.zero); } } }
public void RemoveBar(int ownerId) { if (bars.ContainsKey(ownerId)) { GameObject bar = bars[ownerId]; Follow3DBy2D.StopFollower(bar); bar.SetActive(false); unUsed.Add(bar); bars.Remove(ownerId); } }
public void ReleaseItem() { if (null != itemGo) { if (isFollowing) { isFollowing = false; Follow3DBy2D.StopFollower(itemGo); } CachedClone.RemoveClone(itemGo, false); itemGo = null; item = null; } }
public Transform AddBar(int ownerId, Transform followTrans, Vector3 followDelta) { GameObject bar = CreateBar(); Follow3DBy2D.FollowTrans(bar, followTrans, followDelta); if (bars.ContainsKey(ownerId)) { Debug.LogError("Repeat KEY!!!:" + ownerId); } if (!bars.ContainsKey(ownerId)) { bars.Add(ownerId, bar); } return(bar.transform); }
public static Follow3DBy2D FollowTrans(GameObject follower, Transform follow_trans, Vector3 follow_delta) { Follow3DBy2D comp = follower.GetComponent <Follow3DBy2D>(); if (null == comp) { comp = follower.AddComponent <Follow3DBy2D>(); } comp.mFollowType = FollowType.FOLLOW_TRANS; comp.followTrans = follow_trans; comp.followDelta = follow_delta; comp.enabled = true; comp.Init(); comp.RefreshPos(); return(comp); }
public static Follow3DBy2D FollowPos(GameObject follower, Vector3 follow_pos) { Follow3DBy2D comp = follower.GetComponent <Follow3DBy2D>(); if (null == comp) { comp = follower.AddComponent <Follow3DBy2D>(); } comp.mFollowType = FollowType.FOLLOW_POINT; comp.followPosition = follow_pos; comp.followTrans = null; comp.enabled = true; comp.Init(); comp.RefreshPos(); return(comp); }
public void StopFollow() { Follow3DBy2D.StopFollower(CachedGo); }
public void Follow(Transform followee) { Follow3DBy2D.FollowTrans(CachedGo, followee, new Vector3(0, 0.5f, 0)); }